diff options
| author | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-18 00:59:33 +0000 |
|---|---|---|
| committer | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-18 00:59:33 +0000 |
| commit | ca9e049bc145ae985bc0e2dd6079dacdd51717ac (patch) | |
| tree | 4c44aaa3ed1ee1b4f15732664c05cfc9214e1fa9 /libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java | |
| parent | fb3a09c214e19c97d3751003d9a2ea8008f5005e (diff) | |
Imported GNU Classpath gcj-import-20051117.
* gnu/java/net/protocol/file/Connection.java: Removed, fully merged.
* sources.am: Regenerated.
* Makefile.in: Likewise.
From-SVN: r107153
Diffstat (limited to 'libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java')
| -rw-r--r-- | libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java index 2a3556a5db9..c8754a3e049 100644 --- a/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -475,7 +475,6 @@ public class BasicMenuItemUI extends MenuItemUI menuItem.setHorizontalTextPosition(SwingConstants.TRAILING); menuItem.setHorizontalAlignment(SwingConstants.LEADING); - menuItem.setOpaque(true); } /** @@ -553,11 +552,20 @@ public class BasicMenuItemUI extends MenuItemUI */ protected void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { - Dimension size = getPreferredSize(menuItem); - Color foreground = g.getColor(); - g.setColor(bgColor); - g.drawRect(0, 0, size.width, size.height); - g.setColor(foreground); + // Menu item is considered to be highlighted when it is selected. + // But we don't want to paint the background of JCheckBoxMenuItems + ButtonModel mod = menuItem.getModel(); + if ((menuItem.isSelected() && checkIcon == null) || (mod != null && + mod.isArmed()) + && (menuItem.getParent() instanceof MenuElement)) + { + if (menuItem.isContentAreaFilled()) + { + g.setColor(selectionBackground); + g.fillRect(0, 0, menuItem.getWidth(), menuItem.getHeight()); + } + } + } /** @@ -612,28 +620,6 @@ public class BasicMenuItemUI extends MenuItemUI br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; - // Menu item is considered to be highlighted when it is selected. - // But we don't want to paint the background of JCheckBoxMenuItems - ButtonModel mod = m.getModel(); - if ((m.isSelected() && checkIcon == null) || (mod != null && - mod.isArmed()) - && (m.getParent() instanceof MenuElement)) - { - if (m.isContentAreaFilled()) - { - g.setColor(selectionBackground); - g.fillRect(br.x, br.y, br.width, br.height); - } - } - else - { - if (m.isContentAreaFilled()) - { - g.setColor(m.getBackground()); - g.fillRect(br.x, br.y, br.width, br.height); - } - } - // If this menu item is a JCheckBoxMenuItem then paint check icon if (checkIcon != null) { |
