Yesterday there was someone in Facebook Java Group asked how to get selected value from RadioButton in Java Swing. Actually this problem is very easy to be solved, but since in the past i didn’t learn Swing in depth and never use RadioButton except in web based projects which are on different side so i took a search on google and read some books 😀

Program java netbeans memilih makanan 'KANTIN STMIK ERESHA'. Jika kita memilih untuk memesan paket makanan lagi, maka aplikasi akan menampilkan kembali menu utama. Pilihan Menu Makanan.

This is a limited offer and will soon expire and revert back to the normal member price. Agent We now have 363,399 downloads in the member section. Take the FileFixation now for more detailed information!

We need to locate RadioButton inside ButtonGroup so that RadioButton works as group not individually because RadioButton’s behavior is can be selected just one in one group. Moreover we have to set the action command for RadioButton, this is like the value of it. So here’s my solution

Suppose you design the Frame using Netbeans GUI Builder

When jButton is clicked, jLabel1 will show whether “male” or “female” depends on your choice.

2
4
6
8
10
publicMainFrame(){
jRadioButton2.setActionCommand('Female');
buttonGroup=newButtonGroup();
buttonGroup.add(jRadioButton2);

As i mentioned above, we set the action command and place RadioButton inside ButtonGroup. To get the value of your choice simply using buttonGroup object.

Software

Facebook Comments

Popular Posts

2
4
6
8
10
publicMainFrame(){
jRadioButton2.setActionCommand('Female');
buttonGroup=newButtonGroup();
buttonGroup.add(jRadioButton2);

As i mentioned above, we set the action command and place RadioButton inside ButtonGroup. To get the value of your choice simply using buttonGroup object.

Software

Facebook Comments
...">Menampilkan Pilihan Dengan Java Netbeans(29.04.2020)
  • 2
    4
    6
    8
    10
    publicMainFrame(){
    jRadioButton2.setActionCommand('Female');
    buttonGroup=newButtonGroup();
    buttonGroup.add(jRadioButton2);

    As i mentioned above, we set the action command and place RadioButton inside ButtonGroup. To get the value of your choice simply using buttonGroup object.

    Software

    Facebook Comments
    ...">Menampilkan Pilihan Dengan Java Netbeans(29.04.2020)