/[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.13 by trebligd, Mon Sep 12 13:33:45 2005 UTC revision 1.14 by rabbit78, Mon Sep 12 14:49:52 2005 UTC
# Line 55  import javax.swing.border.Border; Line 55  import javax.swing.border.Border;
55  import javax.swing.plaf.BorderUIResource;  import javax.swing.plaf.BorderUIResource;
56  import javax.swing.plaf.UIResource;  import javax.swing.plaf.UIResource;
57  import javax.swing.plaf.basic.BasicBorders;  import javax.swing.plaf.basic.BasicBorders;
58    import javax.swing.text.JTextComponent;
59    
60    
61  /**  /**
# Line 435  public class MetalBorders Line 436  public class MetalBorders
436       */       */
437      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,
438          int h)          int h)
439      {              {
440        if (c.isEnabled())        JTextComponent tc = (JTextComponent) c;
441          if (tc.isEnabled() && tc.isEditable())
442          super.paintBorder(c, g, x, y, w, h);          super.paintBorder(c, g, x, y, w, h);
443        else        else
444          {          {
# Line 922  public class MetalBorders Line 924  public class MetalBorders
924    }    }
925    
926    /**    /**
927       * A border for table header cells.
928       *
929       * @since 1.3
930       */
931      public static class TableHeaderBorder extends AbstractBorder
932      {
933        /**
934         * The insets of this border.
935         */
936        // TODO: According to tests that I have done, this is really the border
937        // that should be returned by getBorderInsets(). However, the name
938        // is very distracting. Is there any deeper meaning in it?
939        protected Insets editorBorderInsets;
940    
941        /**
942         * Creates a new instance of <code>TableHeaderBorder</code>.
943         */
944        public TableHeaderBorder()
945        {
946          editorBorderInsets = new Insets(1, 1, 1, 1);
947        }
948    
949        /**
950         * Return the insets of this border.
951         *
952         * @return the insets of this border
953         */
954        public Insets getBorderInsets(Component c)
955        {
956          return editorBorderInsets;
957        }
958    
959        /**
960         * Paints the border.
961         *
962         * @param c the component for which to paint the border
963         * @param g the graphics context to use
964         * @param x the x cooridinate of the border rectangle
965         * @param y the y cooridinate of the border rectangle
966         * @param w the width of the border rectangle
967         * @param h the height of the border rectangle
968         */
969        public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
970        {
971          Color dark = MetalLookAndFeel.getControlDarkShadow();
972          Color light = MetalLookAndFeel.getWhite();
973          Color old = g.getColor();
974          g.setColor(light);
975          g.drawLine(x, y, x + w - 2, y);
976          g.drawLine(x, y, x, y + h - 2);
977          g.setColor(dark);
978          g.drawLine(x + w - 1, y, x + w - 1, y + h - 1);
979          g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
980          g.setColor(old);
981        }
982      }
983    
984      /**
985     * Returns a border for Swing buttons in the Metal Look &amp; Feel.     * Returns a border for Swing buttons in the Metal Look &amp; Feel.
986     *     *
987     * @return a border for Swing buttons in the Metal Look &amp; Feel     * @return a border for Swing buttons in the Metal Look &amp; Feel

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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