Package javafx.scene.control
Interface Toggle
- All Known Implementing Classes:
RadioButton
,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
TypePropertyDescriptionThe selected state for thisToggle
.TheToggleGroup
to which thisToggle
belongs. -
Method Summary
Modifier and TypeMethodDescriptionReturns an observable map of properties on this toggle for use primarily by application developers.Returns TheToggleGroup
to which thisToggle
belongs.Returns a previously set Object property, or null if no such property has been set using theNode.setUserData(java.lang.Object)
method.boolean
Indicates whether thisToggle
is selected.The selected state for thisToggle
.void
setSelected
(boolean selected) Sets thisToggle
as selected or unselected.void
setToggleGroup
(ToggleGroup toggleGroup) Sets theToggleGroup
to which thisToggle
belongs.void
setUserData
(Object value) Convenience method for setting a single Object property that can be retrieved at a later date.TheToggleGroup
to which thisToggle
belongs.
-
Property Details
-
toggleGroup
ObjectProperty<ToggleGroup> toggleGroupPropertyTheToggleGroup
to which thisToggle
belongs. -
selected
The selected state for thisToggle
.- See Also:
-
-
Method Details
-
getToggleGroup
ToggleGroup getToggleGroup()Returns TheToggleGroup
to which thisToggle
belongs.- Returns:
- The
ToggleGroup
to which thisToggle
belongs.
-
setToggleGroup
Sets theToggleGroup
to which thisToggle
belongs.- Parameters:
toggleGroup
- The newToggleGroup
.
-
toggleGroupProperty
ObjectProperty<ToggleGroup> toggleGroupProperty()TheToggleGroup
to which thisToggle
belongs.- Returns:
- the
toggleGroup
property - See Also:
-
isSelected
boolean isSelected()Indicates whether thisToggle
is selected.- Returns:
true
if thisToggle
is selected.
-
setSelected
void setSelected(boolean selected) Sets thisToggle
as selected or unselected.- Parameters:
selected
-true
to make thisToggle
selected.
-
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
-