buttongroup

How to get the text value of JRadioButton

亡梦爱人 提交于 2019-12-01 13:39:35
I am creating a project in java. My Program has 80 JRadioButtons .... I need the get the text value of them.. Now these radiobuttons are added to ButtonGroup(each has 4 radio buttons)... I know how to get the text value from the radio button by this following code radiobutton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String q1=e.getActionCommand(); JOptionPane.showMessageDialog(null, q1); } }); Now is there any easy way to do this? because i will have to do this above code for 80 times(for eighty radiobuttons if i use the above use the

How to get the text value of JRadioButton

↘锁芯ラ 提交于 2019-12-01 10:47:48
问题 I am creating a project in java. My Program has 80 JRadioButtons .... I need the get the text value of them.. Now these radiobuttons are added to ButtonGroup(each has 4 radio buttons)... I know how to get the text value from the radio button by this following code radiobutton1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String q1=e.getActionCommand(); JOptionPane.showMessageDialog(null, q1); } }); Now is there any easy way to do this?

How to add a radio button group in a core java program such that only one radio button is selected at one time?

試著忘記壹切 提交于 2019-11-30 07:55:57
问题 I am building a project in core java. BUt i'm stuck in making a radio button group ( for entering the gender (male/female). For that i need a radio group such that only one radio button is selected at one time; and take the input into the database accordingly. Please help. 回答1: Kindly try using ButtonGroup component and add two JRadioButton components named male and female to the ButtonGroup object and then display it in a JFrame using setVisible(true); method. The Below code should be useful

How to add a radio button group in a core java program such that only one radio button is selected at one time?

两盒软妹~` 提交于 2019-11-29 05:43:58
I am building a project in core java. BUt i'm stuck in making a radio button group ( for entering the gender (male/female). For that i need a radio group such that only one radio button is selected at one time; and take the input into the database accordingly. Please help. G.Srinivas Kishan Kindly try using ButtonGroup component and add two JRadioButton components named male and female to the ButtonGroup object and then display it in a JFrame using setVisible(true); method. The Below code should be useful :- import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing