JavaFX 21 Tutorial 6 - RadioButton
Вставка
- Опубліковано 21 сер 2024
- In this tutorial, I will show you how to use radio buttons using JavaFX 21 LTS with IntelliJ 2023.2.4 on Windows 11 x64.
Radio Buttons enable the user to choose a single item from a group of choice.
To group radio buttons, you need to create an object of ToggleGroup and set a radio button’s toggleGroup property to join the group as follows;
ToggleGroup tgFruit = new ToggleGroup();
rbApple.setToggleGroup(tgFruit);
rbOrange.setToggleGroup(tgFruit);
rbPear.setToggleGroup(tgFruit);
In this way, only one radio button can be selected from the same button group for radio buttons.
Using the Scene Builder, this is a quite simple procedure. In this tutorial, you set the Toggle Group property to “tgFruit” for all three radio buttons.
Note: I have updated my IntelliJ IDEA to 2023.2.4 on 29 October 2023.
#JavaFX21 #IntelliJ #RadioButton
thanks for the video ♥
You're welcome 😊
Can you please make MenuButton Tutorial JavaFX is amazing
See ua-cam.com/video/eM50t2LWEaY/v-deo.html