Class ToggleGroupValue<T>

java.lang.Object
javafx.scene.control.ToggleGroup
jfxtras.scene.control.ToggleGroupValue<T>
Type Parameters:
T -

public class ToggleGroupValue<T> extends javafx.scene.control.ToggleGroup
An extended ToggleGroup that adds a value property. Toggles should be added to this group using the add method, which takes a toggle and a value. Whenever the selected toggle changes, the corresponding value is set in the value property. Vice versa, when the value property is set, the corresponding toggle is selected. Note: - The associated values are stored in the toggle's UserData property. - Of course values have to be unique, but this is not checked (if not, you'll usually see an endless loop). - Null is used for when no toggle is selected. Basic usage of is as follows: [source,java] -- ToggleGroupValue lToggleGroupValue = new ToggleGroupValue(); lToggleGroupValue.add(new RadioButton(), "value1"); lToggleGroupValue.add(new RadioButton(), "value2"); lToggleGroupValue.add(new RadioButton(), "value3"); lToggleGroupValue.valueProperty().addListener(...);' -- The add method is a convenience method for toggle.setToggleGroup and toggle.setUserData.
  • Property Summary

    Properties
    Type
    Property
    Description
    javafx.beans.property.ObjectProperty<T>
    Value:

    Properties inherited from class javafx.scene.control.ToggleGroup

    selectedToggle
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final javafx.beans.property.ObjectProperty<T>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(javafx.scene.control.Toggle toggle, T value)
    Convenience method for toggle's setToggleGroup and setUserData.
    private void
     
    Gets the value of the value property.
    void
    setValue(T value)
    Sets the value of the value property.
    javafx.beans.property.ObjectProperty<T>
    Value:
    withValue(T value)
     

    Methods inherited from class javafx.scene.control.ToggleGroup

    getProperties, getSelectedToggle, getToggles, getUserData, hasProperties, selectedToggleProperty, selectToggle, setUserData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Property Details

  • Field Details

    • valueObjectProperty

      private final javafx.beans.property.ObjectProperty<T> valueObjectProperty
  • Constructor Details

    • ToggleGroupValue

      public ToggleGroupValue()
  • Method Details

    • construct

      private void construct()
    • add

      public void add(javafx.scene.control.Toggle toggle, T value)
      Convenience method for toggle's setToggleGroup and setUserData.
      Parameters:
      toggle -
      value -
    • valueProperty

      public javafx.beans.property.ObjectProperty<T> valueProperty()
      Value:
      Returns:
      the value property
      See Also:
    • getValue

      public T getValue()
      Gets the value of the value property.
      Property description:
      Value:
      Returns:
      the value of the value property
      See Also:
    • setValue

      public void setValue(T value)
      Sets the value of the value property.
      Property description:
      Value:
      Parameters:
      value - the value for the value property
      See Also:
    • withValue

      public ToggleGroupValue<T> withValue(T value)