JRadioButton's not being clicked when clicked--?
I have a JMenu with some radio buttons...For some reason, when I click the stupid things, they won't do anything...and by that, I mean they want change their state to being clicked(as in the circle being filled)..It's like they are disabled...I'll post the snippets of code with them in it:
Code:
JMenu formatMenu = new JMenu("Format");
ButtonGroup bg = new ButtonGroup();
rb0 = new JRadioButton("###",false);
rb0.addActionListener(this);
rb2 = new JRadioButton("###.##",true);
rb2.addActionListener(this);
rb4 = new JRadioButton("###.####",false);
rb4.addActionListener(this);
rb6 = new JRadioButton("###.######",false);
rb6.addActionListener(this);
bg.add(rb0);
bg.add(rb2);
bg.add(rb4);
bg.add(rb6);
formatMenu.add(rb0);
formatMenu.add(rb2);
formatMenu.add(rb4);
formatMenu.add(rb6);
Why would I not be able to click these buttons?
<Moderator added green check mark>
Re: JRadioButton's not being clicked when clicked--?
I can post the whole thing if you would like ?
Re: JRadioButton's not being clicked when clicked--?
Try adding a JRadioButtonMenuItem to the JMenu instead of adding a JRadioButton
Re: JRadioButton's not being clicked when clicked--?
Wow! That worked; I never knew such a thing existed...Thank you.