Module javafx.controls
Package javafx.scene.control

# Class ToggleGroup

java.lang.Object
javafx.scene.control.ToggleGroup

    public class ToggleGroup
    extends Object

A class which contains a reference to all `Toggles` whose `selected` variables should be managed such that only a single ``Toggle`` within the `ToggleGroup` may be selected at any one time.

Generally `ToggleGroups` are managed automatically simply by specifying the name of a `ToggleGroup` on the ``Toggle``, but in some situations it is desirable to explicitly manage which `ToggleGroup` is used by ``Toggles``.

Since:
  JavaFX 2.0

- ## Property Summary

  Properties
  Type | Property | Description
  --- | --- | ---
  `ReadOnlyObjectProperty<Toggle>` | `selectedToggle` | The selected toggle.

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `ToggleGroup()` | Creates a default ToggleGroup instance.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `ObservableMap<Object,​Object>` | `getProperties()` | Returns an observable map of properties on this node for use primarily by application developers.
  `Toggle` | `getSelectedToggle()` | Gets the selected `Toggle`.
  `ObservableList<Toggle>` | `getToggles()` | The list of toggles within the ToggleGroup.
  `Object` | `getUserData()` | Returns a previously set Object property, or null if no such property has been set using the `setUserData(java.lang.Object)` method.
  `boolean` | `hasProperties()` | Tests if ToggleGroup has properties.
  `ReadOnlyObjectProperty<Toggle>` | `selectedToggleProperty()` | The selected toggle.
  `void` | `selectToggle​(Toggle value)` | Selects the toggle.
  `void` | `setUserData​(Object value)` | Convenience method for setting a single Object property that can be retrieved at a later date.

  ### Methods declared in class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Property Details

  - ### selectedToggle

    public final ReadOnlyObjectProperty<Toggle> selectedToggleProperty
    The selected toggle.
    See Also:
      `getSelectedToggle()`

- ## Constructor Details

  - ### ToggleGroup

    public ToggleGroup()
    Creates a default ToggleGroup instance.

- ## Method Details

  - ### getToggles

    public final ObservableList<Toggle> getToggles()
    The list of toggles within the ToggleGroup.
    Returns:
      the list of toggles within the ToggleGroup

  - ### selectToggle

    public final void selectToggle​(Toggle value)
    Selects the toggle.
    Parameters:
      `value` - The `Toggle` that is to be selected.

  - ### getSelectedToggle

    public final Toggle getSelectedToggle()
    Gets the selected `Toggle`.
    Returns:
      Toggle The selected toggle.

  - ### selectedToggleProperty

    public final ReadOnlyObjectProperty<Toggle> selectedToggleProperty()
    The selected toggle.
    See Also:
      `getSelectedToggle()`

  - ### getProperties

    public final ObservableMap<Object,​Object> getProperties()
    Returns an observable map of properties on this node for use primarily by application developers.
    Returns:
      an observable map of properties on this node for use primarily by application developers
    Since:
      JavaFX 8u40

  - ### hasProperties

    public boolean hasProperties()
    Tests if ToggleGroup has properties.
    Returns:
      true if node has properties.
    Since:
      JavaFX 8u40

  - ### setUserData

    public 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 `getUserData()`.
    Parameters:
      `value` - The value to be stored - this can later be retrieved by calling `getUserData()`.
    Since:
      JavaFX 8u40

  - ### getUserData

    public Object getUserData()
    Returns a previously set Object property, or null if no such property has been set using the `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.
    Since:
      JavaFX 8u40