From ca9e049bc145ae985bc0e2dd6079dacdd51717ac Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 18 Nov 2005 00:59:33 +0000 Subject: 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 --- .../javax/swing/plaf/basic/BasicMenuItemUI.java | 42 ++++++++-------------- 1 file changed, 14 insertions(+), 28 deletions(-) (limited to 'libjava/classpath/javax/swing/plaf/basic/BasicMenuItemUI.java') 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) { -- cgit v1.2.3