public class ToggleButton extends AbstractButton implements java.awt.ItemSelectable, BooleanState
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."Checkbox,
ButtonController,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected BooleanStateGroup |
group |
protected java.awt.event.ItemListener |
itemListener |
protected static java.lang.String |
itemListenerK
Internal constant for serialization
|
protected static java.awt.Color |
TOGGLE_BACKGROUND
The default background color when the toggle button is selected.
|
actionCommand, controlleralignment, CENTER, EAST, label, LEFT, NORTH, NORTHEAST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHWEST, WESTDefaultToolkit, doubleBuffered, focusTraversable, offscreenBuffer, toolTip| コンストラクタと説明 |
|---|
ToggleButton()
Creates a toggle button with empty label.
|
ToggleButton(java.lang.String label)
Creates a toggle button with the specified label.
|
ToggleButton(java.lang.String label,
boolean state)
Creates a toggle button with the specified label.
|
ToggleButton(java.lang.String label,
boolean state,
BooleanStateGroup group)
Creates a toggle button with the specified label, in the specified
group, and set to the specified state.
|
ToggleButton(Text text)
Creates a toggle button with the specified text.
|
ToggleButton(Text text,
boolean state)
Creates a toggle button with the specified text.
|
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.
|
ToggleButton(VAbstractButton button)
Creates a toggle button with the specified visual button.
|
ToggleButton(VAbstractButton button,
boolean state)
Creates a toggle button with the specified visual button.
|
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.
|
ToggleButton(Visualizable visualizable)
Creates a toggle button with the specified visual object.
|
ToggleButton(Visualizable visualizable,
boolean state)
Creates a toggle button with the specified visual object.
|
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.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
actionPerformed()
Invoked when the button has been triggered by the controller.
|
void |
addItemListener(java.awt.event.ItemListener l)
Adds the specified item listener to receive item events from
this toggle button/check box.
|
BooleanStateGroup |
getBooleanStateGroup()
Determines this toggle button/check box's group.
|
protected java.awt.Color |
getButtonBackground()
Gets the background color for the button.
|
java.lang.Object[] |
getSelectedObjects()
Returns the an array (length 1) containing the toggle button/check box
label or null if the checkbox is not selected.
|
boolean |
getState()
Determines whether this toggle button/check box is in the "on" or
"off" state.
|
void |
itemStateChanged(boolean selected)
Invoked when the button has been toggled by the controller.
|
protected void |
notifyItemListeners(java.awt.event.ItemEvent e) |
protected void |
processEvent(java.awt.AWTEvent e) |
void |
removeItemListener(java.awt.event.ItemListener l)
Removes the specified item listener so that the item listener
no longer receives item events from this check box.
|
void |
setBooleanStateGroup(BooleanStateGroup g)
Sets this toggle button/check box's group to be the specified group.
|
void |
setState(boolean state)
Sets the state of this toggle button/check box to the specified state.
|
void |
setStateInternal(boolean state)
Helper function for
setState. |
getActionCommand, getController, getLabel, getVButton, isFocusTraversable, setActionCommand, setLabel, setVButton, setVButtonInnergetAlignment, getMinimumSize, getPreferredSize, getText, getTEXT, getVisualizable, getVLabel, paintOn, setAlignment, setBackground, setBounds, setEnabled, setFont, setForeground, setLabelSize, setText, setText, setTEXT, setVisualizable, setVLabeladdNotify, bounds, disable, doLayout, enable, enable, getBounds, getFrame, getLocation, getPreferredGraphics, getPreferredGraphics, getSize, getToolTipText, getToolTipVisual, hide, isDirectNotification, isDoubleBuffered, layout, location, minimumSize, paint, postOldEvent, preferredSize, processMouseEvent, processMouseMotionEvent, repaintNow, requestFocus, reshape, setDoubleBuffered, setFocusTraversable, setToolTipText, setToolTipText, setToolTipVisual, setVisible, show, show, size, syncGraphics, syncGraphics, syncGraphics, updateaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disableEvents, dispatchEvent, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, list, list, locate, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validateprotected BooleanStateGroup group
protected transient java.awt.event.ItemListener itemListener
protected static final java.awt.Color TOGGLE_BACKGROUND
protected static final java.lang.String itemListenerK
public ToggleButton()
public ToggleButton(java.lang.String label)
label - a string label for this toggle button.public ToggleButton(java.lang.String label,
boolean state)
state argument, and
it is not part of any group.label - a string label for this toggle button.state - the initial state of this toggle button.public ToggleButton(java.lang.String label,
boolean state,
BooleanStateGroup group)
label - a string label for this toggle button.state - the initial state of this toggle button.group - a group for this toggle button.public ToggleButton(Text text)
text - a text for this toggle button.public ToggleButton(Text text, boolean state)
state argument, and
it is not part of any group.text - a text for this toggle button.state - the initial state of this toggle button.public ToggleButton(Text text, boolean state, BooleanStateGroup group)
text - a text label for this toggle button.state - the initial state of this toggle button.group - a group for this toggle button.public ToggleButton(Visualizable visualizable)
visualizable - a visual object for this toggle button.public ToggleButton(Visualizable visualizable, boolean state)
state argument,
and it is not part of any group.visualizable - a visual object for this toggle button.state - the initial state of this toggle button.public ToggleButton(Visualizable visualizable, boolean state, BooleanStateGroup group)
visualizable - a visual object label for this toggle button.state - the initial state of this toggle button.group - a group for this toggle button.public ToggleButton(VAbstractButton button)
button - a visual button label for this toggle button.public ToggleButton(VAbstractButton button, boolean state)
state argument,
and it is not part of any group.button - a visual button label for this toggle button.state - the initial state of this toggle button.public ToggleButton(VAbstractButton button, boolean state, BooleanStateGroup group)
button - a visual button label for this toggle button.state - the initial state of this toggle button.group - a group for this toggle button.protected java.awt.Color getButtonBackground()
getButtonBackground クラス内 Labelpublic boolean getState()
true indicates the "on"
state, and false indicates the "off" state.getState インタフェース内 BooleanStatesetState(boolean)public void setState(boolean state)
true indicates the "on" state, and
false indicates the "off" state.setState インタフェース内 BooleanStatestate - the boolean state of the toggle button/check box.getState()public void setStateInternal(boolean state)
setState.public java.lang.Object[] getSelectedObjects()
getSelectedObjects インタフェース内 java.awt.ItemSelectablepublic BooleanStateGroup getBooleanStateGroup()
getBooleanStateGroup インタフェース内 BooleanStatenull
if the check box is not part of a group.setBooleanStateGroup(jp.kyasu.awt.BooleanStateGroup)public void setBooleanStateGroup(BooleanStateGroup g)
g - the new group, or null to remove this
toggle button/check box from any group.getBooleanStateGroup()public void addItemListener(java.awt.event.ItemListener l)
addItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.public void removeItemListener(java.awt.event.ItemListener l)
removeItemListener インタフェース内 java.awt.ItemSelectablel - the item listener.public void actionPerformed()
actionPerformed クラス内 AbstractButtonpublic void itemStateChanged(boolean selected)
itemStateChanged クラス内 AbstractButtonprotected void notifyItemListeners(java.awt.event.ItemEvent e)
protected void processEvent(java.awt.AWTEvent e)
processEvent クラス内 java.awt.Component