MyException - 我的异常网
当前位置:我的异常网» J2SE » JRadioButton组件有关问题,求指点

JRadioButton组件有关问题,求指点

www.MyException.Cn  网友分享于:2013-11-23  浏览:406次
JRadioButton组件问题,求指点
package com.law;
import java.awt.*;
import javax.swing.*;
public class JRadioButtonTest extends JFrame
{
public JRadioButtonTest()
{
setTitle("JRadioButton组件");
Container container=getContentPane();
JRadioButton jb1=new JRadioButton("button1");
JRadioButton jb2=new JRadioButton("button2");
JRadioButton jb3=new JRadioButton("button3");
ButtonGroup group=new ButtonGroup();
group.add(jb1);
group.add(jb2);
group.add(jb3);
container.add(group); setBounds(100,100,300,300);
setVisible(true);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
public static void main(String[] args) 
{
new JRadioButtonTest();
}
}
ButtonGroup不能这样添加到容器么?提示这个错误,不知怎么解决。求指点。谢谢!
The method add(Component) in the type Container is not applicable for the arguments (ButtonGroup)


------解决方案--------------------
问题解决就结贴给分哈

探讨

谢谢!

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有