Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ToggleGroup

[12:7] extends: FxObj, Control

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