Module javafx.controls
Package javafx.scene.control

# Interface Toggle

All Known Implementing Classes:
  `RadioButton`, `RadioMenuItem`, `ToggleButton`

    public interface Toggle

Represents a control that can be toggled between selected and non-selected states. In addition, a Toggle can be assigned a ``ToggleGroup``, which manages all assigned Toggles such that only a single Toggle within the ``ToggleGroup`` may be selected at any one time.

Since:
  JavaFX 2.0

- ## Property Summary

  Properties
  Type | Property | Description
  --- | --- | ---
  `BooleanProperty` | `selected` | The selected state for this `Toggle`.
  `ObjectProperty<ToggleGroup>` | `toggleGroup` | The `ToggleGroup` to which this `Toggle` belongs.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `ObservableMap<Object,​Object>` | `getProperties()` | Returns an observable map of properties on this toggle for use primarily by application developers.
  `ToggleGroup` | `getToggleGroup()` | Returns The `ToggleGroup` to which this `Toggle` belongs.
  `Object` | `getUserData()` | Returns a previously set Object property, or null if no such property has been set using the `Node.setUserData(java.lang.Object)` method.
  `boolean` | `isSelected()` | Indicates whether this `Toggle` is selected.
  `BooleanProperty` | `selectedProperty()` | The selected state for this `Toggle`.
  `void` | `setSelected​(boolean selected)` | Sets this `Toggle` as selected or unselected.
  `void` | `setToggleGroup​(ToggleGroup toggleGroup)` | Sets the `ToggleGroup` to which this `Toggle` belongs.
  `void` | `setUserData​(Object value)` | Convenience method for setting a single Object property that can be retrieved at a later date.
  `ObjectProperty<ToggleGroup>` | `toggleGroupProperty()` | The `ToggleGroup` to which this `Toggle` belongs.

- ## Property Details

  - ### toggleGroup

    ObjectProperty<ToggleGroup> toggleGroupProperty
    The `ToggleGroup` to which this `Toggle` belongs.
    See Also:
      `getToggleGroup()`, `setToggleGroup(ToggleGroup)`

  - ### selected

    BooleanProperty selectedProperty
    The selected state for this `Toggle`.
    See Also:
      `isSelected()`, `setSelected(boolean)`

- ## Method Details

  - ### getToggleGroup

    ToggleGroup getToggleGroup()
    Returns The `ToggleGroup` to which this `Toggle` belongs.
    Returns:
      The `ToggleGroup` to which this `Toggle` belongs.

  - ### setToggleGroup

    void setToggleGroup​(ToggleGroup toggleGroup)
    Sets the `ToggleGroup` to which this `Toggle` belongs.
    Parameters:
      `toggleGroup` - The new `ToggleGroup`.

  - ### toggleGroupProperty

    ObjectProperty<ToggleGroup> toggleGroupProperty()
    The `ToggleGroup` to which this `Toggle` belongs.
    See Also:
      `getToggleGroup()`, `setToggleGroup(ToggleGroup)`

  - ### isSelected

    boolean isSelected()
    Indicates whether this `Toggle` is selected.
    Returns:
      `true` if this `Toggle` is selected.

  - ### setSelected

    void setSelected​(boolean selected)
    Sets this `Toggle` as selected or unselected.
    Parameters:
      `selected` - `true` to make this `Toggle` selected.

  - ### selectedProperty

    BooleanProperty selectedProperty()
    The selected state for this `Toggle`.
    See Also:
      `isSelected()`, `setSelected(boolean)`

  - ### getUserData

    Object getUserData()
    Returns a previously set Object property, or null if no such property has been set using the `Node.setUserData(java.lang.Object)` method.
    Returns:
      The Object that was previously set, or null if no property has been set or if null was set.

  - ### setUserData

    void setUserData​(Object value)
    Convenience method for setting a single Object property that can be retrieved at a later date. This is functionally equivalent to calling the getProperties().put(Object key, Object value) method. This can later be retrieved by calling `Node.getUserData()`.
    Parameters:
      `value` - The value to be stored - this can later be retrieved by calling `Node.getUserData()`.

  - ### getProperties

    ObservableMap<Object,​Object> getProperties()
    Returns an observable map of properties on this toggle for use primarily by application developers.
    Returns:
      An observable map of properties on this toggle for use primarily by application developers