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);
4 ответов
+ 1
If you have used buttonGroup1 to bind them together to accept single selection than you should use
buttonGroup1.clearSelection();
method to clear them.
0
can you please explain it in more detail????