All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.StateCheckBox

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----symantec.itools.awt.StateCheckBox

public class StateCheckBox
extends Canvas
A two- or three-state checkbox that doesn't have an associated text label. A two-state checkbox behaves just like the standard checkbox. In three-state mode clicking the checkbox can switch the checkbox to a third state that appears both gray and checked.

The third state is often used to indicate that an attribute of the current selection varies across the selected items. For example, a checkbox used to indicate "bold text" might use the third state if the currently selected text included both bold and plain characters.

It is also used to indicate a default action or state.


Variable Index

 o STATE_CHECKED
A state constant indicating that the current state is "checked".
 o STATE_DEFAULT
A state constant indicating that the current state is "default".
 o STATE_UNCHECKED
A state constant indicating that the current state is "unchecked".
 o THREE_STATE
A style constant indicating that this is a three-state checkbox.
 o TWO_STATE
A style constant indicating that this is a two-state checkbox.

Constructor Index

 o StateCheckBox()
Constructs a two-state StateCheckBox that is currently unchecked.

Method Index

 o disable()
Disables this component so that it doesn't respond to user input.
 o enable()
Enables this component so that it will respond to user input.
 o getState()
Gets the current checkbox state: unchecked, checked, or default.
 o getStyle()
Gets the current style: two-state or three-state.
 o mouseDown(Event, int, int)
Processes MOUSE_DOWN events.
 o mouseEnter(Event, int, int)
Processes MOUSE_ENTER events.
 o mouseExit(Event, int, int)
Processes MOUSE_EXIT events.
 o mouseUp(Event, int, int)
Processes MOUSE_UP events.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o reshape(int, int, int, int)
Moves and/or resizes this component.
 o setState(int)
Sets the current checkbox state to unchecked, checked, or default.
 o setStyle(int)
Sets the current style to two-state or three-state.

Variables

 o TWO_STATE
  public final static int TWO_STATE
A style constant indicating that this is a two-state checkbox.

 o THREE_STATE
  public final static int THREE_STATE
A style constant indicating that this is a three-state checkbox.

 o STATE_UNCHECKED
  public final static int STATE_UNCHECKED
A state constant indicating that the current state is "unchecked".

 o STATE_CHECKED
  public final static int STATE_CHECKED
A state constant indicating that the current state is "checked".

 o STATE_DEFAULT
  public final static int STATE_DEFAULT
A state constant indicating that the current state is "default". Default is the third state of a three-state checkbox.

Constructors

 o StateCheckBox
  public StateCheckBox()
Constructs a two-state StateCheckBox that is currently unchecked.

Methods

 o setStyle
  public void setStyle(int type)
Sets the current style to two-state or three-state.

Parameters:
type - new StateCheckBox state; either TWO_STATE or THREE_STATE
See Also:
getStyle, TWO_STATE, THREE_STATE
 o getStyle
  public int getStyle()
Gets the current style: two-state or three-state.

Returns:
the current StateCheckBox style; either TWO_STATE or THREE_STATE
See Also:
setStyle, TWO_STATE, THREE_STATE
 o getState
  public int getState()
Gets the current checkbox state: unchecked, checked, or default.

Returns:
the current state: STATE_UNCHECKED, STATE_CHECKED, or STATE_DEFAULT
See Also:
getState, STATE_UNCHECKED, STATE_CHECKED, STATE_DEFAULT
 o setState
  public void setState(int state)
Sets the current checkbox state to unchecked, checked, or default.

Parameters:
state - the new state: STATE_UNCHECKED, STATE_CHECKED, or STATE_DEFAULT
See Also:
getState, STATE_UNCHECKED, STATE_CHECKED, STATE_DEFAULT
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Processes MOUSE_DOWN events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DOWN event. These events occur when the mouse button is pressed while inside this component. This method notes that the mouse is pressed inside the box and repaints it.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDown in class Component
See Also:
mouseUp, handleEvent
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
Processes MOUSE_UP events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_UP event. These events occur when the mouse button is released while inside this component. If the mouse was pressed inside the box then the component is repainted and an event is posted.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseUp in class Component
See Also:
mouseDown, handleEvent
 o mouseEnter
  public boolean mouseEnter(Event e,
                            int x,
                            int y)
Processes MOUSE_ENTER events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_ENTER event. These events occur when the mouse first moves over this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseEnter in class Component
See Also:
mouseExit, handleEvent
 o mouseExit
  public boolean mouseExit(Event e,
                           int x,
                           int y)
Processes MOUSE_EXIT events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_EXIT event. These events occur when the mouse first leaves this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseExit in class Component
See Also:
mouseEnter, handleEvent
 o reshape
  public void reshape(int x,
                      int y,
                      int width,
                      int height)
Moves and/or resizes this component. This is a standard Java AWT method which gets called to move and/or resize this component. Components that are in containers with layout managers should not call this method, but rely on the layout manager instead. It is overriden here to note the requested width and height.

Parameters:
x - horizontal position in the parent's coordinate space
y - vertical position in the parent's coordinate space
width - the new width
height - the new height
Overrides:
reshape in class Component
 o preferredSize
  public Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component. If this component has been reshaped, then the width and height of that request are returned.

Overrides:
preferredSize in class Component
See Also:
minimumSize
 o enable
  public synchronized void enable()
Enables this component so that it will respond to user input. This is a standard Java AWT method which gets called to enable this component. Once enabled this component will respond to user input.

Overrides:
enable in class Component
See Also:
disable
 o disable
  public synchronized void disable()
Disables this component so that it doesn't respond to user input. This is a standard Java AWT method which gets called to disable this component. Once disabled this component will not respond to user input.

Overrides:
disable in class Component
See Also:
enable
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Canvas
See Also:
repaint, update

All Packages  Class Hierarchy  This Package  Previous  Next  Index