javax.swing
public class JToggleButton extends AbstractButton implements Accessible
JToggleButton
component provides a stateful button,
which can be either selected or unselected. This provides the basis
for the implementations of radio buttons (JRadioButton
)
and check boxes (JCheckBox
).
Since: 1.2
See Also: JRadioButton JCheckBox
Nested Class Summary | |
---|---|
protected class | JToggleButton.AccessibleJToggleButton
This class provides accessibility support for the toggle button. |
static class | JToggleButton.ToggleButtonModel
The model handles the storage and maintenance of the state of
the toggle button. |
Constructor Summary | |
---|---|
JToggleButton()
Constructs an unselected toggle button with no text or icon. | |
JToggleButton(Action a)
Constructs a toggle button using the labelling, state
and icon specified by the supplied action.
| |
JToggleButton(Icon icon)
Constructs an unselected toggle button with the supplied icon
and no text.
| |
JToggleButton(Icon icon, boolean selected)
Constructs a toggle button with the supplied icon and state.
| |
JToggleButton(String text)
Constructs an unselected toggle button using the supplied text
and no icon.
| |
JToggleButton(String text, boolean selected)
Constructs a toggle button with the supplied text and state.
| |
JToggleButton(String text, Icon icon)
Constructs an unselected toggle button with the supplied text
and icon.
| |
JToggleButton(String text, Icon icon, boolean selected)
Constructs a toggle button with the supplied text, icon and state.
|
Method Summary | |
---|---|
AccessibleContext | getAccessibleContext()
Gets the AccessibleContext associated with this JToggleButton .
|
String | getUIClassID()
Returns a string that specifies the name of the Look and Feel
class that renders this component.
|
protected String | paramString()
Returns a textual representation of this component for debugging.
|
void | updateUI()
This method resets the toggle button's UI delegate to the default UI for
the current look and feel. |
Parameters: a the action to use to define the properties of the button.
Parameters: icon the icon to use.
Parameters: icon the icon to use. selected if true, the toggle button is initially in the selected state. Otherwise, the button is unselected.
Parameters: text the text to use.
Parameters: text the text to use. selected if true, the toggle button is initially in the selected state. Otherwise, the button is unselected.
Parameters: text the text to use. icon the icon to use.
Parameters: text the text to use. icon the icon to use. selected if true, the toggle button is initially in the selected state. Otherwise, the button is unselected.
JToggleButton
.
The context is created, if necessary.
Returns: the associated context
Returns: The Look and Feel UI class in String
form.
Returns: the component in String
form for debugging.