/[classpath]/classpath/javax/swing/plaf/metal/MetalBorders.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalBorders.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by trebligd, Wed Sep 28 10:00:28 2005 UTC revision 1.24 by rabbit78, Wed Sep 28 12:45:32 2005 UTC
# Line 686  public class MetalBorders Line 686  public class MetalBorders
686    /**    /**
687     * A border used for {@link JMenu} and {@link JMenuItem} components.     * A border used for {@link JMenu} and {@link JMenuItem} components.
688     */     */
689    public static class MenuItemBorder    public static class MenuItemBorder extends AbstractBorder
690        extends AbstractBorder      implements UIResource
       implements UIResource  
691    {    {
692      /** The border insets. */      /** The border insets. */
693      protected static Insets borderInsets = new Insets(2, 2, 2, 2);      protected static Insets borderInsets = new Insets(1, 1, 1, 1);
       
     // 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);  
694            
695      /**      /**
696       * Creates a new border instance.       * Creates a new border instance.
# Line 718  public class MetalBorders Line 713  public class MetalBorders
713      public void paintBorder(Component c, Graphics g, int x, int y, int w,      public void paintBorder(Component c, Graphics g, int x, int y, int w,
714          int h)          int h)
715      {      {
716          Color dark = MetalLookAndFeel.getPrimaryControlDarkShadow();
717          Color light = MetalLookAndFeel.getPrimaryControlHighlight();
718        if (c instanceof JMenu) {        if (c instanceof JMenu) {
719          JMenu menu = (JMenu) c;          JMenu menu = (JMenu) c;
720          if (menu.isSelected())          if (menu.isSelected())
721          {          {
722            g.setColor(borderColorDark);            g.setColor(dark);
723            g.drawLine(x, y, x, y + h);            g.drawLine(x, y, x, y + h);
724            g.drawLine(x, y, x + w, y);            g.drawLine(x, y, x + w, y);
725            g.drawLine(x + w - 2, y + 1, x + w - 2, y + h);            g.drawLine(x + w - 2, y + 1, x + w - 2, y + h);
726            g.setColor(borderColorLight);            g.setColor(light);
727            g.drawLine(x + w - 1, y + 1, x + w - 1, y + h);            g.drawLine(x + w - 1, y + 1, x + w - 1, y + h);
728          }          }
729        }        }
# Line 734  public class MetalBorders Line 731  public class MetalBorders
731        {        {
732          JMenuItem item = (JMenuItem) c;          JMenuItem item = (JMenuItem) c;
733          if (item.isArmed())          if (item.isArmed())
734          {            {
735            g.setColor(borderColorDark);              g.setColor(dark);
736            g.drawLine(x, y, x + w, y);              g.drawLine(x, y, x + w, y);
737            g.setColor(borderColorLight);              g.setColor(light);
738            g.drawLine(x, y + h - 1, x + w, y + h - 1);              g.drawLine(x, y + h - 1, x + w, y + h - 1);
739          }                      }
740            else
741              {
742                // Normally we draw a light line on the left.
743                g.setColor(light);
744                g.drawLine(x, y, x, y + h);
745              }
746        }        }
747      }      }
748            
# Line 1019  public class MetalBorders Line 1022  public class MetalBorders
1022    {    {
1023    
1024      /** The border's insets. */      /** The border's insets. */
1025      protected static Insets borderInsets = new Insets(2, 2, 1, 1);      protected static Insets borderInsets = new Insets(3, 1, 2, 1);
1026    
1027      /**      /**
1028       * Constructs a new PopupMenuBorder.       * Constructs a new PopupMenuBorder.
# Line 1089  public class MetalBorders Line 1092  public class MetalBorders
1092                
1093        // draw highlighted inner border (only top and left)        // draw highlighted inner border (only top and left)
1094        g.setColor(light);        g.setColor(light);
       g.drawLine(x + 1, y + 1, x + 1, y + h - 2);  
1095        g.drawLine(x + 1, y + 1, x + w - 2, y + 1);        g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
1096      }      }
1097            
# Line 1267  public class MetalBorders Line 1269  public class MetalBorders
1269        JToolBar tb = (JToolBar) c;        JToolBar tb = (JToolBar) c;
1270        if (tb.getOrientation() == JToolBar.HORIZONTAL)        if (tb.getOrientation() == JToolBar.HORIZONTAL)
1271          {          {
1272             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,
1273                    MetalLookAndFeel.getControlHighlight(),                    MetalLookAndFeel.getControlHighlight(),
1274                    MetalLookAndFeel.getControlDarkShadow());                    MetalLookAndFeel.getControlDarkShadow());
1275          }          }
1276        else        else
1277          {          {
1278            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,
1279                    MetalLookAndFeel.getControlHighlight(),                    MetalLookAndFeel.getControlHighlight(),
1280                    MetalLookAndFeel.getControlDarkShadow());                    MetalLookAndFeel.getControlDarkShadow());
1281          }          }

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26