Index: javax/swing/plaf/metal/MetalBorders.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalBorders.java,v retrieving revision 1.23 diff -u -r1.23 MetalBorders.java --- javax/swing/plaf/metal/MetalBorders.java 28 Sep 2005 10:00:28 -0000 1.23 +++ javax/swing/plaf/metal/MetalBorders.java 28 Sep 2005 12:45:01 -0000 @@ -686,16 +686,11 @@ /** * A border used for address@hidden JMenu} and address@hidden JMenuItem} components. */ - public static class MenuItemBorder - extends AbstractBorder - implements UIResource + public static class MenuItemBorder extends AbstractBorder + implements UIResource { /** The border insets. */ - protected static Insets borderInsets = new Insets(2, 2, 2, 2); - - // TODO: find where the real colors come from - private static Color borderColorDark = new Color(102, 102, 153); - private static Color borderColorLight = new Color(255, 255, 255); + protected static Insets borderInsets = new Insets(1, 1, 1, 1); /** * Creates a new border instance. @@ -718,15 +713,17 @@ public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { + Color dark = MetalLookAndFeel.getPrimaryControlDarkShadow(); + Color light = MetalLookAndFeel.getPrimaryControlHighlight(); if (c instanceof JMenu) { JMenu menu = (JMenu) c; if (menu.isSelected()) { - g.setColor(borderColorDark); + g.setColor(dark); g.drawLine(x, y, x, y + h); g.drawLine(x, y, x + w, y); g.drawLine(x + w - 2, y + 1, x + w - 2, y + h); - g.setColor(borderColorLight); + g.setColor(light); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h); } } @@ -734,12 +731,18 @@ { JMenuItem item = (JMenuItem) c; if (item.isArmed()) - { - g.setColor(borderColorDark); - g.drawLine(x, y, x + w, y); - g.setColor(borderColorLight); - g.drawLine(x, y + h - 1, x + w, y + h - 1); - } + { + g.setColor(dark); + g.drawLine(x, y, x + w, y); + g.setColor(light); + g.drawLine(x, y + h - 1, x + w, y + h - 1); + } + else + { + // Normally we draw a light line on the left. + g.setColor(light); + g.drawLine(x, y, x, y + h); + } } } @@ -1019,7 +1022,7 @@ { /** The border's insets. */ - protected static Insets borderInsets = new Insets(2, 2, 1, 1); + protected static Insets borderInsets = new Insets(3, 1, 2, 1); /** * Constructs a new PopupMenuBorder. @@ -1089,7 +1092,6 @@ // draw highlighted inner border (only top and left) g.setColor(light); - g.drawLine(x + 1, y + 1, x + 1, y + h - 2); g.drawLine(x + 1, y + 1, x + w - 2, y + 1); } @@ -1267,13 +1269,13 @@ JToolBar tb = (JToolBar) c; if (tb.getOrientation() == JToolBar.HORIZONTAL) { - MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + 11, y + h - 5, + MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + 11, y + h - 5, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); } else { - MetalUtils.fillMetalPattern(g, x + 2, y + 2, x + w - 5, y + 11, + MetalUtils.fillMetalPattern(tb, g, x + 2, y + 2, x + w - 5, y + 11, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow()); }