borland Packages  Class Hierarchy  jbcl.view Package  Index 

CheckboxItemPainter component

java.lang.Object
   +----borland.jbcl.view.CheckboxItemPainter
           +----borland.jbcl.view.CheckboxStateItemPainter

About the CheckboxItemPainter component

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.


CheckboxItemPainter variables

Variables implemented in this class

CheckboxItemPainter constructors

CheckboxItemPainter properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

CheckboxItemPainter methods

Methods implemented in this class

Methods implemented in java.lang.Object


CheckboxItemPainter variables

border

  protected BorderItemPainter border

boxSize

  protected Dimension boxSize

CHECKMARK

  public static final int CHECKMARK = 1
Indicates that a check mark is to be painted in the check box.

checkStyle

  protected int checkStyle

drawBox

  protected boolean drawBox

flat

  protected boolean flat

XMARK

  public static final int XMARK = 2
Indicates that an X is to be painted in the check box.

CheckboxItemPainter constructors

CheckboxItemPainter()

  public CheckboxItemPainter()
Constructs a CheckboxItemPainter.

CheckboxItemPainter(java.awt.Dimension)

  public CheckboxItemPainter(java.awt.Dimension boxSize)
Constructs a CheckboxItemPainter with the specfied boxSize.

Parameters:

boxSize
The Dimension object that specifies the size of the box around the check mark.

CheckboxItemPainter(java.awt.Dimension, int)

  public CheckboxItemPainter(java.awt.Dimension boxSize, int checkStyle)
Constructs a CheckboxItemPainter with the specified box size and the specified style of check.

Parameters:

boxSize
The Dimension object that specifies the size of the box around the check mark.
checkStyle
Specify the style as CHECKMARK (a check) or XMARK (an X).

CheckboxItemPainter(java.awt.Dimension, int, boolean)

  public CheckboxItemPainter(java.awt.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
The Dimension object that specifies the size of the box around the check mark.
checkStyle
The style of the check: CHECKMARK or XMARK.
flat
If true, the check box does not appear raised; if false, the check box has a slight 3-D appearance.

CheckboxItemPainter(java.awt.Dimension, int, boolean, boolean)

  public CheckboxItemPainter(java.awt.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
The Dimension object that specifies the size of the box around the check mark.
checkStyle
The style of the check: CHECKMARK or XMARK.
flat
If true, the check box does not appear raised; if false, the check box has a slight 3-D appearance.
drawBox
If true, the check box has a border drawn around it; if false, no border is drawn.

CheckboxItemPainter properties

boxSize

 public Dimension getBoxSize()
 public void setBoxSize(java.awt.Dimension boxSize)
Determines the size of the check box.

Parameters:

boxSize
A Dimension object that specifies the size you want the check box to be.

drawBox

 public boolean isDrawBox()
 public void setDrawBox(boolean drawBox)
Determines whether the item painter draws a box around the item.

flat

 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
If true, the check box has a flat appearance; if false, the check box has a slight 3-D appearance.

style

 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
Specify CHECKMARK or XMARK.

CheckboxItemPainter methods

drawBox(java.awt.Graphics, int, int, int, int, int)

  protected void drawBox(java.awt.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.

drawCheck(java.awt.Graphics, int, int, int, int, int)

  protected void drawCheck(java.awt.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.

isChecked(java.lang.Object, int, borland.jbcl.model.ItemPaintSite)

  protected boolean isChecked(java.lang.Object data, int state, borland.jbcl.model.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
The Object that determines whether the check is checked.
state
The state of the check box.
site
The ItemPaintSite where the check box is painted.