com.sun.kjava
Class CheckBox

java.lang.Object
  |
  +--com.sun.kjava.CheckBox

public class CheckBox
extends java.lang.Object

A checkbox user interface object. A CheckBox object displays a check box next to a text label. It has two states, checked and unchecked.


Constructor Summary
CheckBox()
          Create a new checkbox at an undefined position with no text label.
CheckBox(int x, int y, java.lang.String text)
          Create a new checkbox at a given position with a text label.
 
Method Summary
 void handlePenDown(int x, int y)
          The user selected the CheckBox; invert its state.
 void paint()
          Paint the CheckBox.
 boolean pressed(int x, int y)
          Did the user's "press" fall within the CheckBox?
 void setLocation(int x, int y)
          Set the CheckBox's position.
 void setState(boolean state)
          Set the state and redraw to reflect it.
 void setText(java.lang.String text)
          Set the CheckBox's label.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckBox

public CheckBox()
Create a new checkbox at an undefined position with no text label.

CheckBox

public CheckBox(int x,
                int y,
                java.lang.String text)
Create a new checkbox at a given position with a text label.
Parameters:
x - the X coordinate of position.
y - the Y coordinate of position.
text - label of the CheckBox
Method Detail

setLocation

public void setLocation(int x,
                        int y)
Set the CheckBox's position.
Parameters:
x - the X coordinate of position.
y - the Y coordinate of position.

setText

public void setText(java.lang.String text)
Set the CheckBox's label.

paint

public void paint()
Paint the CheckBox.

handlePenDown

public void handlePenDown(int x,
                          int y)
The user selected the CheckBox; invert its state. If it was checked, set the state to unchecked, and vice-versa. This will cause the CheckBox to redraw itself.

pressed

public boolean pressed(int x,
                       int y)
Did the user's "press" fall within the CheckBox?
Parameters:
x - the X coordinate of the user's press
y - the Y coordinate of the user's press
Returns:
true if (x, y) fall within bounds

setState

public void setState(boolean state)
Set the state and redraw to reflect it.
Parameters:
state - the new state