jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java
changeset 25178 dbab904451e9
parent 22574 7f8ce0c8c20a
equal deleted inserted replaced
25177:487a5e71f6dd 25178:dbab904451e9
    47  * @author Steve Wilson
    47  * @author Steve Wilson
    48  */
    48  */
    49 @SuppressWarnings("serial") // Same-version serialization only
    49 @SuppressWarnings("serial") // Same-version serialization only
    50 public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
    50 public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
    51 
    51 
       
    52     /**
       
    53      * Returns the size of the control.
       
    54      *
       
    55      * @return the size of the control
       
    56      */
    52     protected int getControlSize() { return 13; }
    57     protected int getControlSize() { return 13; }
    53 
    58 
    54     public void paintIcon(Component c, Graphics g, int x, int y) {
    59     public void paintIcon(Component c, Graphics g, int x, int y) {
    55 
    60 
    56         JCheckBox cb = (JCheckBox)c;
    61         JCheckBox cb = (JCheckBox)c;
    89             }
    94             }
    90             drawCheck(c,g,x,y);
    95             drawCheck(c,g,x,y);
    91         }
    96         }
    92     }
    97     }
    93 
    98 
       
    99     /**
       
   100      * Paints {@code MetalCheckBoxIcon}.
       
   101      *
       
   102      * @param c a component
       
   103      * @param g an instance of {@code Graphics}
       
   104      * @param x an X coordinate
       
   105      * @param y an Y coordinate
       
   106      */
    94     protected void drawCheck(Component c, Graphics g, int x, int y) {
   107     protected void drawCheck(Component c, Graphics g, int x, int y) {
    95         int controlSize = getControlSize();
   108         int controlSize = getControlSize();
    96         g.fillRect( x+3, y+5, 2, controlSize-8 );
   109         g.fillRect( x+3, y+5, 2, controlSize-8 );
    97         g.drawLine( x+(controlSize-4), y+3, x+5, y+(controlSize-6) );
   110         g.drawLine( x+(controlSize-4), y+3, x+5, y+(controlSize-6) );
    98         g.drawLine( x+(controlSize-4), y+4, x+5, y+(controlSize-5) );
   111         g.drawLine( x+(controlSize-4), y+4, x+5, y+(controlSize-5) );