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
-
ToggleButton()
- Creates a toggle button with empty label.
-
ToggleButton(String)
- Creates a toggle button with the specified label.
-
ToggleButton(String, boolean)
- Creates a toggle button with the specified label.
-
ToggleButton(String, boolean, BooleanStateGroup)
- Creates a toggle button with the specified label, in the specified
group, and set to the specified state.
-
ToggleButton(Text)
- Creates a toggle button with the specified text.
-
ToggleButton(Text, boolean)
- Creates a toggle button with the specified text.
-
ToggleButton(Text, boolean, BooleanStateGroup)
- Creates a toggle button with the specified text, in the specified
group, and set to the specified state.
-
ToggleButton(VAbstractButton)
- Creates a toggle button with the specified visual button.
-
ToggleButton(VAbstractButton, boolean)
- Creates a toggle button with the specified visual button.
-
ToggleButton(VAbstractButton, boolean, BooleanStateGroup)
- Creates a toggle button with the specified visual button, in the
specified group, and set to the specified state.
-
ToggleButton(Visualizable)
- Creates a toggle button with the specified visual object.
-
ToggleButton(Visualizable, boolean)
- Creates a toggle button with the specified visual object.
-
ToggleButton(Visualizable, boolean, BooleanStateGroup)
- Creates a toggle button with the specified visual object, in the
specified group, and set to the specified state.
-
actionPerformed()
- Invoked when the button has been triggered by the controller.
-
addItemListener(ItemListener)
- Adds the specified item listener to receive item events from
this toggle button/check box.
-
getBooleanStateGroup()
- Determines this toggle button/check box's group.
-
getSelectedObjects()
- Returns the an array (length 1) containing the toggle button/check box
label or null if the checkbox is not selected.
-
getState()
- Determines whether this toggle button/check box is in the "on" or
"off" state.
-
itemStateChanged(boolean)
- Invoked when the button has been toggled by the controller.
-
removeItemListener(ItemListener)
- Removes the specified item listener so that the item listener
no longer receives item events from this check box.
-
setBooleanStateGroup(BooleanStateGroup)
- Sets this toggle button/check box's group to be the specified group.
-
setState(boolean)
- Sets the state of this toggle button/check box to the specified state.
-
setStateInternal(boolean)
- Helper function for
setState
.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
setStateInternal
public synchronized void setStateInternal(boolean state)
- Helper function for
setState
.
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.
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
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
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.
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.
actionPerformed
public void actionPerformed()
- Invoked when the button has been triggered by the controller.
- Overrides:
- actionPerformed in class AbstractButton
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