jbcl.view Package
java.lang.Object +----com.borland.jbcl.view.CheckboxItemPainter +----com.borland.jbcl.view.CheckboxStateItemPainter
Variables Constructors Properties Methods
Implements ItemPainter, Serializable
CheckboxItemPainter
paints the check within a check box. It attempts to deduce a boolean state from the data. If the data is boolean and has a value of true, a check is painted. If the data is a String
and the value is "true", a check is painted. If the data is a number and is not equal to 0, then a check is painted. If the data is a Variant
and has a data type of one of the above types, a check is painted. If none of these conditions are true, no check is painted and the check box appears unchecked.
The "check" can be a check mark or an X, depending on the value of the style
property. The flat
property and the boxSize
property determine other characteristics of how the check box appears.
The drawBox()
method paints the box around the check and the drawCheck()
draws the check. The isChecked()
method determines whether the check box is checked.
protected BorderItemPainter border
protected Dimension boxSize
public static final int CHECKMARK = 1Indicates that a check mark is to be painted in the check box.
protected int checkStyle
protected boolean drawBox
protected boolean flat
public static final int XMARK = 2Indicates that an X is to be painted in the check box.
public CheckboxItemPainter()Constructs a
CheckboxItemPainter
.
public CheckboxItemPainter(Dimension boxSize)Constructs a
CheckboxItemPainter
with the specfied boxSize
.
Parameters:
boxSize
Dimension
object that specifies the size of the box around the check mark.
public CheckboxItemPainter(Dimension boxSize, int checkStyle)Constructs a
CheckboxItemPainter
with the specified box size and the specified style of check.
Parameters:
boxSize
Dimension
object that specifies the size of the box around the check mark.
checkStyle
public CheckboxItemPainter(Dimension boxSize, int checkStyle, boolean flat)Constructs a
CheckboxItemPainter
with the specified box size, the specified style of check, and the appearance of the check box.
Parameters:
boxSize
checkStyle
flat
public CheckboxItemPainter(Dimension boxSize, int checkStyle, boolean flat, boolean drawBox)Constructs a
CheckboxItemPainter
with the specified box size, the specified style of check, and the specified dimensionality of the check box, and the specified existence of a border drawn around it.
Parameters:
boxSize
checkStyle
flat
drawBox
public Dimension getBoxSize() public void setBoxSize(Dimension boxSize)Determines the size of the check box.
Parameters:
boxSize
Dimension
object that specifies the size you want the check box to be.
public boolean isDrawBox() public void setDrawBox(boolean drawBox)Determines whether the item painter draws a box around the item.
public boolean isFlat() public void setFlat(boolean flat)Determines whether the check box has a flat appearance or a slight 3-D appearance.
Parameters:
flat
public int getStyle() public void setStyle(int checkStyle)Determines the style check in the check box when the check box is checked. The possible values of
style
are CHECKMARK (a check mark is painted) or XMARK (an X is painted).
Parameters:
checkStyle
protected void drawBox(Graphics g, int x, int y, int w, int h, int state)Draws the box around the check. A subclass can overide this method to paint the box around the check.
protected void drawCheck(Graphics g, int x, int y, int w, int h, int state)Draws the check in the check box. A subclass can overide this method to paint the check as desired.
protected boolean isChecked(Object data, int state, ItemPaintSite site)Determines whether the check box is checked depending on the data and the specified state. A subclass can overide this method to define different criteria for the checked state. The default is to analyze the data object and extract a boolean state.
Parameters:
data
state
site
ItemPaintSite
where the check box is painted.