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
PropertiesProperties inherited from class javafx.scene.control.ToggleGroup
selectedToggle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class javafx.scene.control.ToggleGroup
getProperties, getSelectedToggle, getToggles, getUserData, hasProperties, selectedToggleProperty, selectToggle, setUserData
-
Property Details
-
value
Value:- See Also:
-
-
Field Details
-
valueObjectProperty
-
-
Constructor Details
-
ToggleGroupValue
public ToggleGroupValue()
-
-
Method Details
-
construct
private void construct() -
add
Convenience method for toggle's setToggleGroup and setUserData.- Parameters:
toggle
-value
-
-
valueProperty
Value:- Returns:
- the
value
property - See Also:
-
getValue
Gets the value of thevalue
property.- Property description:
- Value:
- Returns:
- the value of the
value
property - See Also:
-
setValue
Sets the value of thevalue
property.- Property description:
- Value:
- Parameters:
value
- the value for thevalue
property- See Also:
-
withValue
-