Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## nextapp.echo2.app.button
Class ToggleButton

    java.lang.Object
      nextapp.echo2.app.Component
          nextapp.echo2.app.button.AbstractButton
              nextapp.echo2.app.button.ToggleButton

All Implemented Interfaces:
  java.io.Serializable, RenderIdSupport

Direct Known Subclasses:
  CheckBox, RadioButton

    public abstract class ToggleButton

extends AbstractButton

An abstract base class for 'two state' buttons.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `PROPERTY_PRESSED_SELECTED_STATE_ICON`
`static java.lang.String` | `PROPERTY_PRESSED_STATE_ICON`
`static java.lang.String` | `PROPERTY_ROLLOVER_SELECTED_STATE_ICON`
`static java.lang.String` | `PROPERTY_ROLLOVER_STATE_ICON`
`static java.lang.String` | `PROPERTY_SELECTED_STATE_ICON`
`static java.lang.String` | `PROPERTY_STATE_ALIGNMENT`
`static java.lang.String` | `PROPERTY_STATE_ICON`
`static java.lang.String` | `PROPERTY_STATE_MARGIN`
`static java.lang.String` | `PROPERTY_STATE_POSITION`
`static java.lang.String` | `SELECTED_CHANGED_PROPERTY`

Fields inherited from class nextapp.echo2.app.button.AbstractButton
`ACTION_LISTENERS_CHANGED_PROPERTY, INPUT_CLICK, PROPERTY_ALIGNMENT, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_DISABLED_BACKGROUND, PROPERTY_DISABLED_BACKGROUND_IMAGE, PROPERTY_DISABLED_BORDER, PROPERTY_DISABLED_FONT, PROPERTY_DISABLED_FOREGROUND, PROPERTY_DISABLED_ICON, PROPERTY_HEIGHT, PROPERTY_ICON, PROPERTY_ICON_TEXT_MARGIN, PROPERTY_INSETS, PROPERTY_LINE_WRAP, PROPERTY_MODEL, PROPERTY_PRESSED_BACKGROUND, PROPERTY_PRESSED_BACKGROUND_IMAGE, PROPERTY_PRESSED_BORDER, PROPERTY_PRESSED_ENABLED, PROPERTY_PRESSED_FONT, PROPERTY_PRESSED_FOREGROUND, PROPERTY_PRESSED_ICON, PROPERTY_ROLLOVER_BACKGROUND, PROPERTY_ROLLOVER_BACKGROUND_IMAGE, PROPERTY_ROLLOVER_BORDER, PROPERTY_ROLLOVER_ENABLED, PROPERTY_ROLLOVER_FONT, PROPERTY_ROLLOVER_FOREGROUND, PROPERTY_ROLLOVER_ICON, PROPERTY_TEXT, PROPERTY_TEXT_ALIGNMENT, PROPERTY_TEXT_POSITION, PROPERTY_TOOL_TIP_TEXT, PROPERTY_WIDTH`

Fields inherited from class nextapp.echo2.app.Component
`CHILDREN_CHANGED_PROPERTY, ENABLED_CHANGED_PROPERTY, FOCUS_TRAVERSAL_INDEX_CHANGED_PROPERTY, FOCUS_TRAVERSAL_PARTICIPANT_CHANGED_PROPERTY, LAYOUT_DIRECTION_CHANGED_PROPERTY, LOCALE_CHANGED_PROPERTY, PROPERTY_BACKGROUND, PROPERTY_FONT, PROPERTY_FOREGROUND, PROPERTY_LAYOUT_DATA, STYLE_CHANGED_PROPERTY, STYLE_NAME_CHANGED_PROPERTY, VISIBLE_CHANGED_PROPERTY`

Constructor Summary
`ToggleButton()`

Method Summary
`void` | `addChangeListener(ChangeListener l)` Adds a `ChangeListener` to receive notification of state changes, i.e., to the selected state of a `ToggleButton`.
`void` | `fireStateChanged()` Notifies all listeners that have registered for this event type.
`ImageReference` | `getPressedSelectedStateIcon()` Returns the selected state icon displayed when the button is being pressed.
`ImageReference` | `getPressedStateIcon()` Returns the default (non-selected) state icon displayed when the button is being pressed.
`ImageReference` | `getRolloverSelectedStateIcon()` Returns the selected state icon displayed when the mouse cursor is inside the bounds of the button.
`ImageReference` | `getRolloverStateIcon()` Returns the default (non-selected) state icon displayed when the mouse cursor is inside the bounds of the button.
`ImageReference` | `getSelectedStateIcon()` Returns the selected state icon.
`Alignment` | `getStateAlignment()` Returns the alignment of the state icon relative to the button's text/icon.
`ImageReference` | `getStateIcon()` Returns the default (non-selected) state icon.
`Extent` | `getStateMargin()` Returns the margin size between the state icon and the toggle button's icon and/or text.
`Alignment` | `getStatePosition()` Returns the position of the state icon relative to the button's text/icon.
`boolean` | `isSelected()` Determines the selection state.
`void` | `removeChangeListener(ChangeListener l)` Removes a `ChangeListener` from being notified of state changes, i.e., to the selected state of a `ToggleButton`.
`void` | `setModel(ButtonModel newValue)` Sets the model that this button represents.
`void` | `setPressedSelectedStateIcon(ImageReference newValue)` Sets the selected state icon displayed when the button is being pressed.
`void` | `setPressedStateIcon(ImageReference newValue)` Sets the default (non-selected) state icon displayed when the button is being pressed.
`void` | `setRolloverSelectedStateIcon(ImageReference newValue)` Sets the selected state icon displayed when the mouse cursor is inside the bounds of the button.
`void` | `setRolloverStateIcon(ImageReference newValue)` Sets the default (non-selected) state icon displayed when the mouse cursor is inside the bounds of the button.
`void` | `setSelected(boolean newValue)` Sets the selection state.
`void` | `setSelectedStateIcon(ImageReference newValue)` Sets the selected state icon.
`void` | `setStateAlignment(Alignment newValue)` Sets the alignment of the state icon relative to the text/icon of the button.
`void` | `setStateIcon(ImageReference newValue)` Sets the default (non-selected) state icon.
`void` | `setStateMargin(Extent newValue)` Sets the margin size between the state icon and the toggle button's icon and/or text.
`void` | `setStatePosition(Alignment newValue)` Sets the position of the state icon relative to the text/icon of the button.

Methods inherited from class nextapp.echo2.app.button.AbstractButton
`addActionListener, doAction, fireActionPerformed, getActionCommand, getAlignment, getBackgroundImage, getBorder, getDisabledBackground, getDisabledBackgroundImage, getDisabledBorder, getDisabledFont, getDisabledForeground, getDisabledIcon, getHeight, getIcon, getIconTextMargin, getInsets, getModel, getPressedBackground, getPressedBackgroundImage, getPressedBorder, getPressedFont, getPressedForeground, getPressedIcon, getRolloverBackground, getRolloverBackgroundImage, getRolloverBorder, getRolloverFont, getRolloverForeground, getRolloverIcon, getText, getTextAlignment, getTextPosition, getToolTipText, getWidth, hasActionListeners, isLineWrap, isPressedEnabled, isRolloverEnabled, isValidChild, processInput, removeActionListener, setActionCommand, setAlignment, setBackgroundImage, setBorder, setDisabledBackground, setDisabledBackgroundImage, setDisabledBorder, setDisabledFont, setDisabledForeground, setDisabledIcon, setHeight, setIcon, setIconTextMargin, setInsets, setLineWrap, setPressedBackground, setPressedBackgroundImage, setPressedBorder, setPressedEnabled, setPressedFont, setPressedForeground, setPressedIcon, setRolloverBackground, setRolloverBackgroundImage, setRolloverBorder, setRolloverEnabled, setRolloverFont, setRolloverForeground, setRolloverIcon, setText, setTextAlignment, setTextPosition, setToolTipText, setWidth`

Methods inherited from class nextapp.echo2.app.Component
`add, add, addPropertyChangeListener, dispose, firePropertyChange, getApplicationInstance, getBackground, getComponent, getComponent, getComponentCount, getComponents, getEventListenerList, getFocusTraversalIndex, getFont, getForeground, getId, getIndexedProperty, getLayoutData, getLayoutDirection, getLocale, getParent, getProperty, getRenderId, getRenderIndexedProperty, getRenderIndexedProperty, getRenderLayoutDirection, getRenderLocale, getRenderProperty, getRenderProperty, getStyle, getStyleName, getVisibleComponent, getVisibleComponentCount, getVisibleComponents, hasEventListenerList, indexOf, init, isAncestorOf, isEnabled, isFocusTraversalParticipant, isRegistered, isRenderEnabled, isRenderVisible, isValidParent, isVisible, remove, remove, removeAll, removePropertyChangeListener, setBackground, setEnabled, setFocusTraversalIndex, setFocusTraversalParticipant, setFont, setForeground, setId, setIndexedProperty, setLayoutData, setLayoutDirection, setLocale, setProperty, setStyle, setStyleName, setVisible, validate, verifyInput, visibleIndexOf`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROPERTY_PRESSED_STATE_ICON

    public static final java.lang.String PROPERTY_PRESSED_STATE_ICON

See Also:
  Constant Field Values

### PROPERTY_PRESSED_SELECTED_STATE_ICON

    public static final java.lang.String PROPERTY_PRESSED_SELECTED_STATE_ICON

See Also:
  Constant Field Values

### PROPERTY_ROLLOVER_STATE_ICON

    public static final java.lang.String PROPERTY_ROLLOVER_STATE_ICON

See Also:
  Constant Field Values

### PROPERTY_ROLLOVER_SELECTED_STATE_ICON

    public static final java.lang.String PROPERTY_ROLLOVER_SELECTED_STATE_ICON

See Also:
  Constant Field Values

### PROPERTY_STATE_ALIGNMENT

    public static final java.lang.String PROPERTY_STATE_ALIGNMENT

See Also:
  Constant Field Values

### PROPERTY_STATE_ICON

    public static final java.lang.String PROPERTY_STATE_ICON

See Also:
  Constant Field Values

### PROPERTY_STATE_MARGIN

    public static final java.lang.String PROPERTY_STATE_MARGIN

See Also:
  Constant Field Values

### PROPERTY_STATE_POSITION

    public static final java.lang.String PROPERTY_STATE_POSITION

See Also:
  Constant Field Values

### PROPERTY_SELECTED_STATE_ICON

    public static final java.lang.String PROPERTY_SELECTED_STATE_ICON

See Also:
  Constant Field Values

### SELECTED_CHANGED_PROPERTY

    public static final java.lang.String SELECTED_CHANGED_PROPERTY

See Also:
  Constant Field Values

Constructor Detail

### ToggleButton

    public ToggleButton()

Method Detail

### addChangeListener

    public void addChangeListener(ChangeListener l)

  Adds a `ChangeListener` to receive notification of state changes, i.e., to the selected state of a `ToggleButton`.

  Parameters:
    `l` - the listener to add

### fireStateChanged

    public void fireStateChanged()

  Notifies all listeners that have registered for this event type.

### getPressedSelectedStateIcon

    public ImageReference getPressedSelectedStateIcon()

  Returns the selected state icon displayed when the button is being pressed.

  Returns:
    the icon

### getPressedStateIcon

    public ImageReference getPressedStateIcon()

  Returns the default (non-selected) state icon displayed when the button is being pressed.

  Returns:
    the icon

### getRolloverSelectedStateIcon

    public ImageReference getRolloverSelectedStateIcon()

  Returns the selected state icon displayed when the mouse cursor is inside the bounds of the button.

  Returns:
    the icon

### getRolloverStateIcon

    public ImageReference getRolloverStateIcon()

  Returns the default (non-selected) state icon displayed when the mouse cursor is inside the bounds of the button.

  Returns:
    the icon

### getSelectedStateIcon

    public ImageReference getSelectedStateIcon()

  Returns the selected state icon.

  Returns:
    the icon

### getStateAlignment

    public Alignment getStateAlignment()

  Returns the alignment of the state icon relative to the button's text/icon.

  Returns:
    the state alignment

### getStateIcon

    public ImageReference getStateIcon()

  Returns the default (non-selected) state icon.

  Returns:
    the icon

### getStateMargin

    public Extent getStateMargin()

  Returns the margin size between the state icon and the toggle button's icon and/or text. The margin will only be displayed in the case where icon and/or text are present. This property only supports `Extent`s with fixed (i.e., not percent) units.

  Returns:
    the margin size

### getStatePosition

    public Alignment getStatePosition()

  Returns the position of the state icon relative to the button's text/icon.

  Returns:
    the state position

### isSelected

    public boolean isSelected()

  Determines the selection state.

  Returns:
    the selection state

### removeChangeListener

    public void removeChangeListener(ChangeListener l)

  Removes a `ChangeListener` from being notified of state changes, i.e., to the selected state of a `ToggleButton`.

  Parameters:
    `l` - the listener to remove

### setModel

    public void setModel(ButtonModel newValue)

  Description copied from class: `AbstractButton`
  Sets the model that this button represents. The model may not be null.

  Overrides:
    `setModel` in class `AbstractButton`
  Parameters:
    `newValue` - the new `ButtonModel`
  See Also:
    `AbstractButton.setModel(nextapp.echo2.app.button.ButtonModel)`

### setPressedSelectedStateIcon

    public void setPressedSelectedStateIcon(ImageReference newValue)

  Sets the selected state icon displayed when the button is being pressed.

  Parameters:
    `newValue` - the new icon

### setPressedStateIcon

    public void setPressedStateIcon(ImageReference newValue)

  Sets the default (non-selected) state icon displayed when the button is being pressed.

  Parameters:
    `newValue` - the new icon

### setRolloverSelectedStateIcon

    public void setRolloverSelectedStateIcon(ImageReference newValue)

  Sets the selected state icon displayed when the mouse cursor is inside the bounds of the button.

  Parameters:
    `newValue` - the new icon

### setRolloverStateIcon

    public void setRolloverStateIcon(ImageReference newValue)

  Sets the default (non-selected) state icon displayed when the mouse cursor is inside the bounds of the button.

  Parameters:
    `newValue` - the new icon

### setSelectedStateIcon

    public void setSelectedStateIcon(ImageReference newValue)

  Sets the selected state icon.

  Parameters:
    `newValue` - the new icon

### setSelected

    public void setSelected(boolean newValue)

  Sets the selection state.

  Parameters:
    `newValue` - the new selection state

### setStateAlignment

    public void setStateAlignment(Alignment newValue)

  Sets the alignment of the state icon relative to the text/icon of the button. Note that only one of the provided `Alignment`'s settings should be non-default.

  Parameters:
    `newValue` - the new state alignment

### setStateIcon

    public void setStateIcon(ImageReference newValue)

  Sets the default (non-selected) state icon.

  Parameters:
    `newValue` - the new icon

### setStateMargin

    public void setStateMargin(Extent newValue)

  Sets the margin size between the state icon and the toggle button's icon and/or text. The margin will only be displayed in the case where icon and/or text are present. This property only supports `Extent`s with fixed (i.e., not percent) units.

  Parameters:
    `newValue` - the new margin size

### setStatePosition

    public void setStatePosition(Alignment newValue)

  Sets the position of the state icon relative to the text/icon of the button. Note that only one of the provided `Alignment`'s settings should be non-default.

  Parameters:
    `newValue` - the new state position

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD