filmov
tv
JavaFX Tutorial 08 - RadioButton GUI

Показать описание
JavaFX Tutorial 08 RadioButton GUI
Code Source :
@Override
public void start(Stage primaryStage) {
// cretae Group
Group gr = new Group();
VBox v = new VBox();
ToggleGroup tg = new ToggleGroup();
RadioButton rb1 = new RadioButton("Cocacola");
RadioButton rb2 = new RadioButton("Fanta");
RadioButton rb3 = new RadioButton("Pepsi");
Scene sc = new Scene(v,600,400);
}
Libraries Importing :
JavaFX RadioButton
Creating a RadioButton
Adding a RadioButton to the Scene Graph
Reading Selected State
ToggleGroup
A JavaFX RadioButton is a button that can be selected or not selected. The RadioButton is very similar to the JavaFX ToggleButton, but with the difference that a RadioButton cannot be "unselected" once selected. If RadioButtons are part of a ToggleGroup then once a RadioButton has been selected for the first time, there must be one RadioButton selected in the ToggleGroup .
Code Source :
@Override
public void start(Stage primaryStage) {
// cretae Group
Group gr = new Group();
VBox v = new VBox();
ToggleGroup tg = new ToggleGroup();
RadioButton rb1 = new RadioButton("Cocacola");
RadioButton rb2 = new RadioButton("Fanta");
RadioButton rb3 = new RadioButton("Pepsi");
Scene sc = new Scene(v,600,400);
}
Libraries Importing :
JavaFX RadioButton
Creating a RadioButton
Adding a RadioButton to the Scene Graph
Reading Selected State
ToggleGroup
A JavaFX RadioButton is a button that can be selected or not selected. The RadioButton is very similar to the JavaFX ToggleButton, but with the difference that a RadioButton cannot be "unselected" once selected. If RadioButtons are part of a ToggleGroup then once a RadioButton has been selected for the first time, there must be one RadioButton selected in the ToggleGroup .