javax.swing.plaf.metal
Class MetalCheckBoxIcon

java.lang.Object
  extended by javax.swing.plaf.metal.MetalCheckBoxIcon
All Implemented Interfaces:
Serializable, Icon, UIResource

public class MetalCheckBoxIcon
extends Object
implements Icon, UIResource, Serializable

An Icon used by the MetalCheckBoxUI class.

See Also:
Serialized Form

Constructor Summary
MetalCheckBoxIcon()
          Creates a new MetalCheckBoxIcon instance.
 
Method Summary
protected  void drawCheck(Component c, Graphics g, int x, int y)
          Draws the check in the CheckBox.
protected  int getControlSize()
          Returns the size (both X and Y) of the checkbox icon.
 int getIconHeight()
          Returns the height of the icon in pixels.
 int getIconWidth()
          Returns the width of the icon in pixels.
 void paintIcon(Component c, Graphics g, int x, int y)
          Paints the icon.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetalCheckBoxIcon

public MetalCheckBoxIcon()
Creates a new MetalCheckBoxIcon instance.

Method Detail

drawCheck

protected void drawCheck(Component c,
                         Graphics g,
                         int x,
                         int y)
Draws the check in the CheckBox.

Parameters:
c - the component to draw on
g - the Graphics context to draw with
x - the X position
y - the Y position

getControlSize

protected int getControlSize()
Returns the size (both X and Y) of the checkbox icon.

Returns:
the size of the checkbox icon

getIconWidth

public int getIconWidth()
Returns the width of the icon in pixels.

Specified by:
getIconWidth in interface Icon
Returns:
the width of the icon in pixels

getIconHeight

public int getIconHeight()
Returns the height of the icon in pixels.

Specified by:
getIconHeight in interface Icon
Returns:
the height of the icon in pixels

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Paints the icon. This first paints the border of the CheckBox and if the CheckBox is selected it calls drawCheck(java.awt.Component, java.awt.Graphics, int, int) to draw the check.

Specified by:
paintIcon in interface Icon
Parameters:
c - the Component to draw on (gets casted to JCheckBox)
g - the Graphics context to draw with
x - the X position
y - the Y position