Shown below is a screenshot of the ToggleSwitch control in its on and off state:
| Modifier and Type | Field and Description |
|---|---|
| private static final String | DEFAULT_STYLE_CLASS
* Stylesheet Handling * * |
| private static final PseudoClass | |
| private BooleanProperty | selected
Indicates whether this ToggleSwitch is selected. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ToggleSwitch(String
The label string of the control. text)Creates a toggle switch with the specified label. |
| Modifier and Type | Method and Description |
|---|---|
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| public void | |
| public String | getUserAgentStylesheet()
Overrides javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. |
| private void | |
| public final boolean | |
| public final BooleanProperty | |
| public final void |
| DEFAULT_STYLE_CLASS | back to summary |
|---|---|
| private static final String DEFAULT_STYLE_CLASS * Stylesheet Handling * * | |
| PSEUDO_CLASS_SELECTED | back to summary |
|---|---|
| private static final PseudoClass PSEUDO_CLASS_SELECTED | |
| selected | back to summary |
|---|---|
| private BooleanProperty selected Indicates whether this ToggleSwitch is selected. | |
| ToggleSwitch | back to summary |
|---|---|
| public ToggleSwitch() Creates a toggle switch with empty string for its label. | |
| ToggleSwitch | back to summary |
|---|---|
| public ToggleSwitch(String text) Creates a toggle switch with the specified label.
| |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. Create a new instance of the default skin for this control. This is called to create a skin for the control if
no skin is provided via CSS
| |
| fire | back to summary |
|---|---|
| public void fire() Toggles the state of the | |
| getUserAgentStylesheet | back to summary |
|---|---|
| public String getUserAgentStylesheet() Overrides javafx. Doc from javafx. An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls. The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath. Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.
For additional information about using CSS with the scene graph,
see the CSS Reference Guide.
| |
| initialize | back to summary |
|---|---|
| private void initialize() | |
| isSelected | back to summary |
|---|---|
| public final boolean isSelected() Returns whether this Toggle Switch is selected | |
| selectedProperty | back to summary |
|---|---|
| public final BooleanProperty selectedProperty() Returns the selected property | |
| setSelected | back to summary |
|---|---|
| public final void setSelected(boolean value) Sets the selected value of this Toggle Switch | |