What is the code to clear all the" radio buttons​ " in NETBEANS JAVA ☺☺☺☺ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the code to clear all the" radio buttons​ " in NETBEANS JAVA ☺☺☺☺

I'm working on a code having 3 radio buttons r1 , r2 and r3,1 text feild t1 and 3 buttons to calculate, clear and exit the code respectively.codes of each buttons are as follows: CALCULATE BUTTON double i=0; if(r1.isSelected()) i=12; else if(r2.isSelected()) i=10; else if(r3.isSelected()) i=9.5; t1.setText(" "+I); CLEAR BUTTON: r1.setSelected(false); r2.setSelected(false); r3.setSelected(false); t1.setText(" "); EXIT BUTTON: System.exit(0);

15th Jul 2017, 2:04 PM
DHEERAJ
DHEERAJ - avatar
2 Answers
+ 1
If you have used buttonGroup1 to bind them together to accept single selection than you should use buttonGroup1.clearSelection(); method to clear them.
14th Feb 2019, 5:59 AM
Bhoop Singh
Bhoop Singh - avatar
0
can you please explain it in more detail????
16th Jul 2017, 3:01 AM
DHEERAJ
DHEERAJ - avatar