Interface Toggle
- All Known Implementing Classes:
RadioButton,RadioMenuItem,ToggleButton
public interface Toggle
Represents a control that can be toggled between selected and non-selected
states. In addition, a Toggle can be assigned a
ToggleGroup, which manages all assigned Toggles such
that only a single Toggle within the ToggleGroup may be
selected at any one time.- Since:
- JavaFX 2.0
-
Property Summary
PropertiesTypePropertyDescriptionThe selected state for thisToggle.TheToggleGroupto which thisTogglebelongs. -
Method Summary
Modifier and TypeMethodDescriptionReturns an observable map of properties on this toggle for use primarily by application developers.Returns TheToggleGroupto which thisTogglebelongs.Returns a previously set Object property, or null if no such property has been set using theNode.setUserData(java.lang.Object)method.booleanIndicates whether thisToggleis selected.The selected state for thisToggle.voidsetSelected(boolean selected) Sets thisToggleas selected or unselected.voidsetToggleGroup(ToggleGroup toggleGroup) Sets theToggleGroupto which thisTogglebelongs.voidsetUserData(Object value) Convenience method for setting a single Object property that can be retrieved at a later date.TheToggleGroupto which thisTogglebelongs.
-
Property Details
-
toggleGroup
ObjectProperty<ToggleGroup> toggleGroupPropertyTheToggleGroupto which thisTogglebelongs.- See Also:
-
selected
-
-
Method Details
-
getToggleGroup
ToggleGroup getToggleGroup()Returns TheToggleGroupto which thisTogglebelongs.- Returns:
- The
ToggleGroupto which thisTogglebelongs.
-
setToggleGroup
Sets theToggleGroupto which thisTogglebelongs.- Parameters:
toggleGroup- The newToggleGroup.
-
toggleGroupProperty
ObjectProperty<ToggleGroup> toggleGroupProperty()TheToggleGroupto which thisTogglebelongs.- Returns:
- the toggle group property
- See Also:
-
isSelected
boolean isSelected()Indicates whether thisToggleis selected.- Returns:
trueif thisToggleis selected.
-
setSelected
void setSelected(boolean selected) Sets thisToggleas selected or unselected.- Parameters:
selected-trueto make thisToggleselected.
-
selectedProperty
BooleanProperty selectedProperty()The selected state for thisToggle.- Returns:
- the selected property
- See Also:
-
getUserData
Object getUserData()Returns a previously set Object property, or null if no such property has been set using theNode.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.
-
setUserData
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 callingNode.getUserData().- Parameters:
value- The value to be stored - this can later be retrieved by callingNode.getUserData().
-
getProperties
ObservableMap<Object,Object> getProperties()Returns an observable map of properties on this toggle for use primarily by application developers.- Returns:
- An observable map of properties on this toggle for use primarily by application developers
-