Any idea how to add a JRadioButton.?
The following code produces this error:
Test.java:2586: Incompatible type for method. Can't convert javax.swing.
ButtonGroup to java.awt.Component.
PanelGroup.add(group);
^
1 error
This is the code:
JPanel PanelGroup = JPanel();
ButtonGroup group = new ButtonGroup();
group.add(oneRadio);
group.add(twoRadio);
group.add(threeRadio);
group.add(fourRadio);
Thanks for your help.
Re: Any idea how to add a JRadioButton.?
as you add the buttons to the button group, it also has to be added to the JPanel since buttonGroup doesn't have anything to do w/ displaying the buttons on screen.. button group handles how the buttons interact w/ each other.
JPanel PanelGroup = new JPanel();
ButtonGroup group = new ButtonGroup();
group.add(one);
PanelGroup.add(one);
etc..
"There are no facts, only interpretations."
-Friedrich Nietzsche