RadioButtons create a series of items where only one item can be
selected. RadioButtons are a specialized ToggleButton.
When a RadioButton is pressed and released a javafx.
is sent. Your application can perform some action based
on this event by implementing an javafx. to
process the javafx..
Only one RadioButton can be selected when placed in a ToggleGroup.
Clicking on a selected RadioButton will have no effect. A RadioButton that is not
in a ToggleGroup can be selected and unselected. By default a RadioButton is
not in a ToggleGroup. Calling ToggleGroup.getSelectedToggle()
will return you the RadioButton that has been selected.
ToggleGroup group = new ToggleGroup();
RadioButton button1 = new RadioButton("select first");
button1.setToggleGroup(group);
button1.setSelected(true);
RadioButton button2 = new RadioButton("select second");
button2.setToggleGroup(group);
| Modifier and Type | Field and Description |
|---|---|
| private static final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | RadioButton(String
A text string for its label. text)Creates a radio button with the specified text as its 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 | fire()
Overrides javafx. Toggles the state of the radio button if and only if the RadioButton
has not already selected or is not part of a |
| protected Pos | getInitialAlignment()
Overrides javafx. Returns the initial alignment state of this control, for use by the JavaFX CSS engine to correctly set its initial value. |
| private void | |
| public Object | queryAccessibleAttribute(AccessibleAttribute
the requested attribute attribute, Object... optional list of parameters parameters)Overrides javafx. This method is called by the assistive technology to request the value for an attribute. |
| DEFAULT_STYLE_CLASS | back to summary |
|---|---|
| private static final String DEFAULT_STYLE_CLASS Hides javafx. | |
| RadioButton | back to summary |
|---|---|
| public RadioButton() Creates a radio button with an empty string for its label. | |
| RadioButton | back to summary |
|---|---|
| public RadioButton(String text) Creates a radio button with the specified text as its 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() Overrides javafx. Toggles the state of the radio button if and only if the RadioButton
has not already selected or is not part of a
| |
| getInitialAlignment | back to summary |
|---|---|
| protected Pos getInitialAlignment() Overrides javafx. Returns the initial alignment state of this control, for use by the JavaFX CSS engine to correctly set its initial value. This method is overridden to use Pos.CENTER_LEFT initially.
| |
| initialize | back to summary |
|---|---|
| private void initialize() | |
| queryAccessibleAttribute | back to summary |
|---|---|
| public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) Overrides javafx. Doc from javafx. This method is called by the assistive technology to request the value for an attribute.
This method is commonly overridden by subclasses to implement
attributes that are required for a specific role.
| |