All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.awt.ToggleButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----jp.kyasu.awt.KComponent
                   |
                   +----jp.kyasu.awt.Label
                           |
                           +----jp.kyasu.awt.AbstractButton
                                   |
                                   +----jp.kyasu.awt.ToggleButton

public class ToggleButton
extends AbstractButton
implements ItemSelectable, BooleanState
The ToggleButton class implements a labeled button that can be in either an "on" (true) or "off" (false) state. Clicking on a toggle button changes its state from "on" to "off," or from "off" to "on."

Version:
12 Jun 1998
Author:
Kazuki YASUMATSU
See Also:
Checkbox, ButtonController

Constructor Index

 o ToggleButton()
Creates a toggle button with empty label.
 o ToggleButton(String)
Creates a toggle button with the specified label.
 o ToggleButton(String, boolean)
Creates a toggle button with the specified label.
 o ToggleButton(String, boolean, BooleanStateGroup)
Creates a toggle button with the specified label, in the specified group, and set to the specified state.
 o ToggleButton(Text)
Creates a toggle button with the specified text.
 o ToggleButton(Text, boolean)
Creates a toggle button with the specified text.
 o ToggleButton(Text, boolean, BooleanStateGroup)
Creates a toggle button with the specified text, in the specified group, and set to the specified state.
 o ToggleButton(VAbstractButton)
Creates a toggle button with the specified visual button.
 o ToggleButton(VAbstractButton, boolean)
Creates a toggle button with the specified visual button.
 o ToggleButton(VAbstractButton, boolean, BooleanStateGroup)
Creates a toggle button with the specified visual button, in the specified group, and set to the specified state.
 o ToggleButton(Visualizable)
Creates a toggle button with the specified visual object.
 o ToggleButton(Visualizable, boolean)
Creates a toggle button with the specified visual object.
 o ToggleButton(Visualizable, boolean, BooleanStateGroup)
Creates a toggle button with the specified visual object, in the specified group, and set to the specified state.

Method Index

 o actionPerformed()
Invoked when the button has been triggered by the controller.
 o addItemListener(ItemListener)
Adds the specified item listener to receive item events from this toggle button/check box.
 o getBooleanStateGroup()
Determines this toggle button/check box's group.
 o getSelectedObjects()
Returns the an array (length 1) containing the toggle button/check box label or null if the checkbox is not selected.
 o getState()
Determines whether this toggle button/check box is in the "on" or "off" state.
 o itemStateChanged(boolean)
Invoked when the button has been toggled by the controller.
 o removeItemListener(ItemListener)
Removes the specified item listener so that the item listener no longer receives item events from this check box.
 o setBooleanStateGroup(BooleanStateGroup)
Sets this toggle button/check box's group to be the specified group.
 o setState(boolean)
Sets the state of this toggle button/check box to the specified state.
 o setStateInternal(boolean)
Helper function for setState.

Constructors

 o ToggleButton
 public ToggleButton()
Creates a toggle button with empty label. The state of this toggle button is set to "off," and it is not part of any group.

 o ToggleButton
 public ToggleButton(String label)
Creates a toggle button with the specified label. The state of this toggle button is set to "off," and it is not part of any group.

Parameters:
label - a string label for this toggle button.
 o ToggleButton
 public ToggleButton(String label,
                     boolean state)
Creates a toggle button with the specified label. The state of this toggle button is as specified by the state argument, and it is not part of any group.

Parameters:
label - a string label for this toggle button.
state - the initial state of this toggle button.
 o ToggleButton
 public ToggleButton(String label,
                     boolean state,
                     BooleanStateGroup group)
Creates a toggle button with the specified label, in the specified group, and set to the specified state.

Parameters:
label - a string label for this toggle button.
state - the initial state of this toggle button.
group - a group for this toggle button.
 o ToggleButton
 public ToggleButton(Text text)
Creates a toggle button with the specified text. The state of this toggle button is set to "off," and it is not part of any group.

Parameters:
text - a text for this toggle button.
 o ToggleButton
 public ToggleButton(Text text,
                     boolean state)
Creates a toggle button with the specified text. The state of this toggle button is as specified by the state argument, and it is not part of any group.

Parameters:
text - a text for this toggle button.
state - the initial state of this toggle button.
 o ToggleButton
 public ToggleButton(Text text,
                     boolean state,
                     BooleanStateGroup group)
Creates a toggle button with the specified text, in the specified group, and set to the specified state.

Parameters:
text - a text label for this toggle button.
state - the initial state of this toggle button.
group - a group for this toggle button.
 o ToggleButton
 public ToggleButton(Visualizable visualizable)
Creates a toggle button with the specified visual object. The state of this toggle button is set to "off," and it is not part of any group.

Parameters:
visualizable - a visual object for this toggle button.
 o ToggleButton
 public ToggleButton(Visualizable visualizable,
                     boolean state)
Creates a toggle button with the specified visual object. The state of this toggle button is as specified by the state argument, and it is not part of any group.

Parameters:
visualizable - a visual object for this toggle button.
state - the initial state of this toggle button.
 o ToggleButton
 public ToggleButton(Visualizable visualizable,
                     boolean state,
                     BooleanStateGroup group)
Creates a toggle button with the specified visual object, in the specified group, and set to the specified state.

Parameters:
visualizable - a visual object label for this toggle button.
state - the initial state of this toggle button.
group - a group for this toggle button.
 o ToggleButton
 public ToggleButton(VAbstractButton button)
Creates a toggle button with the specified visual button. The state of this toggle button is set to "off," and it is not part of any group.

Parameters:
button - a visual button label for this toggle button.
 o ToggleButton
 public ToggleButton(VAbstractButton button,
                     boolean state)
Creates a toggle button with the specified visual button. The state of this toggle button is as specified by the state argument, and it is not part of any group.

Parameters:
button - a visual button label for this toggle button.
state - the initial state of this toggle button.
 o ToggleButton
 public ToggleButton(VAbstractButton button,
                     boolean state,
                     BooleanStateGroup group)
Creates a toggle button with the specified visual button, in the specified group, and set to the specified state.

Parameters:
button - a visual button label for this toggle button.
state - the initial state of this toggle button.
group - a group for this toggle button.

Methods

 o getState
 public boolean getState()
Determines whether this toggle button/check box is in the "on" or "off" state. The boolean value true indicates the "on" state, and false indicates the "off" state.

Returns:
the state of this toggle button/check box, as a boolean value.
See Also:
setState
 o setState
 public void setState(boolean state)
Sets the state of this toggle button/check box to the specified state. The boolean value true indicates the "on" state, and false indicates the "off" state.

Parameters:
state - the boolean state of the toggle button/check box.
See Also:
getState
 o setStateInternal
 public synchronized void setStateInternal(boolean state)
Helper function for setState.

 o getSelectedObjects
 public Object[] getSelectedObjects()
Returns the an array (length 1) containing the toggle button/check box label or null if the checkbox is not selected.

 o getBooleanStateGroup
 public BooleanStateGroup getBooleanStateGroup()
Determines this toggle button/check box's group.

Returns:
this toggle button/check box's group, or null if the check box is not part of a group.
See Also:
setBooleanStateGroup
 o setBooleanStateGroup
 public void setBooleanStateGroup(BooleanStateGroup g)
Sets this toggle button/check box's group to be the specified group. If this toggle button/check box is already in a different group, it is first taken out of that group.

Parameters:
g - the new group, or null to remove this toggle button/check box from any group.
See Also:
getBooleanStateGroup
 o addItemListener
 public synchronized void addItemListener(ItemListener l)
Adds the specified item listener to receive item events from this toggle button/check box.

Parameters:
l - the item listener.
 o removeItemListener
 public synchronized void removeItemListener(ItemListener l)
Removes the specified item listener so that the item listener no longer receives item events from this check box.

Parameters:
l - the item listener.
 o actionPerformed
 public void actionPerformed()
Invoked when the button has been triggered by the controller.

Overrides:
actionPerformed in class AbstractButton
 o itemStateChanged
 public void itemStateChanged(boolean selected)
Invoked when the button has been toggled by the controller.

Overrides:
itemStateChanged in class AbstractButton

All Packages  Class Hierarchy  This Package  Previous  Next  Index