|
-
October 4th, 2000, 06:05 PM
#1
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.
-
October 4th, 2000, 10:10 PM
#2
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|