Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ToggleGroup

[12:7] extends: FxObj

Wraps JavaFX ToggleGroup, which ensures that at most one ToggleButton or RadioButton in the group is selected at any time. When the user selects a new button, the previously selected button is automatically deselected. This class provides methods to retrieve the text of the currently selected toggle and to register a callback that fires whenever the selection changes.

Methods

  • ToggleGroup ()

    Initializes a new ToggleGroup instance.

    • @r this object
  • getSelected ()

    Retrieves the text of the currently selected ToggleButton in the group.

    • @r string The text of the selected ToggleButton, or an empty string if none is selected.
  • onChange (callback OnChange)

    Sets a callback function to execute when the selected ToggleButton changes.

    • @p OnChange The callback function for handling selection change events.
    • @r this object for chaining
  • getToggles ()

    Returns the live ObservableList of toggles in this group.

    • @r An AJO around an ObservableList.
  • selectToggle (object Toggle)

    Selects the given Toggle in the group, deselecting any previously selected toggle.

    • @p Toggle is a wrapper whose .obj holds a javafx.scene.control.Toggle.
    • @r this object for chaining
  • getSelectedToggle ()

    Returns the currently selected Toggle, or null when none is selected.

    • @r An AJO around javafx.scene.control.Toggle, or null.
  • selectedToggleProperty ()

    Returns the read-only property backing the selected toggle.

    • @r A ReadOnlyObjectProperty AJO.
  • getProperties ()

    Returns the observable property map associated with this toggle group. The map is created on first access.

    • @r An AJO around an ObservableMap<Object,Object>.
  • hasProperties ()

    Returns whether any user properties have been attached to this group.

    • @r A bool; true when the properties map is non-empty.
  • setUserData (UserData)

    Attaches an arbitrary user data value to this toggle group.

    • @p UserData is the value to store, or null to clear.
    • @r this object for chaining
  • getUserData ()

    Returns the user data value previously attached to this toggle group.

    • @r The stored value, unwrapped to its Aussom type when possible.