For Example,
JButtonGroup g=new JButtonGroup();
JRadioButton DecimalConvert=new JRadioButton("Decimal Converting");
g.add(DecimalConvert);
DecimalConvert.addActionListener(this);
I made a program to convert Decimal to binari and hexa and octal also each of them to another . I create 4 RadioButtons but I Don't know how to add Actions to them if the user choss Octal do Octal converting
Thanx for Reading My Comment , Appreciate it
goodShrikant Badiger June 29, 2011 at 3:29 PM
hi this is nice example to understand the radio button functionality thanks and regards shrikant badiger
How to add actionListener to RadioButtonPink tree November 13, 2011 at 12:58 AM
For Example, JButtonGroup g=new JButtonGroup(); JRadioButton DecimalConvert=new JRadioButton("Decimal Converting"); g.add(DecimalConvert); DecimalConvert.addActionListener(this); I made a program to convert Decimal to binari and hexa and octal also each of them to another . I create 4 RadioButtons but I Don't know how to add Actions to them if the user choss Octal do Octal converting Thanx for Reading My Comment , Appreciate it
radioFed February 15, 2012 at 2:37 PM
if(textField.getText().isEmpty() || textField_1.getText().isEmpty() || textField_2.getText().isEmpty() ){ JOptionPane.showMessageDialog(frame,"Podaj wszystkie wymiary!!!"); } else { if (rbt1.isSelected()){ if (textField_3.getText().isEmpty()){ JOptionPane.showMessageDialog(frame,"Podaj cene Plytek!!!"); } else{ int wys = Integer.parseInt(textField.getText()); int szer = Integer.parseInt(textField_1.getText()); int dl = Integer.parseInt(textField_2.getText()); int cena = Integer.parseInt(textField_3.getText()); int okna = Integer.parseInt(textField_8.getText()); float powierzchnia; float koszt; powierzchnia = (dl*szer + 2*szer*wys + 2*dl*wys) - okna; koszt = powierzchnia * cena; textField_6.setText("" +powierzchnia); textField_7.setText("" + koszt); } } if (rbt2.isSelected()){ if (textField_4.getText().isEmpty()){ JOptionPane.showMessageDialog(frame,"Podaj cene Paneli!!!"); } else{ int wys = Integer.parseInt(textField.getText()); int szer = Integer.parseInt(textField_1.getText()); int dl = Integer.parseInt(textField_2.getText()); int cena = Integer.parseInt(textField_4.getText()); int okna = Integer.parseInt(textField_8.getText()); float powierzchnia; float koszt; powierzchnia = (dl*szer + 2*szer*wys + 2*dl*wys) - okna; koszt = powierzchnia * cena; textField_6.setText("" +powierzchnia); textField_7.setText("" + koszt); } } if (rbt3.isSelected()){ if (textField_5.getText().isEmpty()){ JOptionPane.showMessageDialog(frame,"Podaj cene Farby!!!"); } else{ int wys = Integer.parseInt(textField.getText()); int szer = Integer.parseInt(textField_1.getText()); int dl = Integer.parseInt(textField_2.getText()); int cena = Integer.parseInt(textField_5.getText()); int okna = Integer.parseInt(textField_8.getText()); float powierzchnia; float koszt; powierzchnia = (dl*szer + 2*szer*wys + 2*dl*wys) - okna; koszt = powierzchnia * cena; textField_6.setText("" +powierzchnia); textField_7.setText("" + koszt); } } } } });
javaravindra April 4, 2012 at 11:36 AM
pleas insert the so many example programs coding a radio buttons.
javaPavan April 4, 2012 at 7:18 PM
thanks
Remove selected radio button or check box Alex Leong October 16, 2012 at 6:32 PM
how to remove the selected radio button?
Post your Comment