你不看这两个构造方法吗: JRadioButton(String text, Icon icon) Creates a radio button that has the specified text and image, and that is initially unselected. JRadioButton(String text, Icon icon, boolean selected) Creates a radio button that has the specified text, image, and selection state.
设置了jFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE),点击了JFRAME的关闭按钮后,窗口就隐藏了,如何让它再次出现呢?
谢谢
JButton jb = new JButton( "OK", image.gif );方法2:
ImageIcon ii = new ImageIcon( "image.gif" );
JButton jb = new JButton( "OK", ii );
ImageIcon selectedIcon=new ImageIcon("F:\\b.jpg");
ImageIcon disabledIcon=new ImageIcon("F:\\c.jpg");
ImageIcon disabledSelectedIcon=new ImageIcon("F:\\d.jpg"); JButton jb=new JButton();
jb.setBounds(200, 200, 20, 30);
jb.setIcon(defaultIcon); //设置按钮的默认图标
jb.setSelectedIcon(selectedIcon); //设置按钮的选择图标
jb.setDisabledIcon(disabledIcon);//设置按钮的禁用图标
jb.setDisabledSelectedIcon(disabledSelectedIcon);//设置按钮的禁用选择图标[/align]
JRadioButton(Icon icon, boolean selected)
创建一个具有指定图像和选择状态的单选按钮,但无文本。
但我试了好像不行,那个单选的小圆点的按钮就没看到了。jb.setSelectedIcon(selectedIcon); //设置按钮的选择图标
这个选择图标什么时候显示出来,我可以看到,并不是在我点击按钮的时候显示,这句代码我也能写出来,但我看不到任何效果。
JRadioButton(String text, Icon icon)
Creates a radio button that has the specified text and image, and that is initially unselected.
JRadioButton(String text, Icon icon, boolean selected)
Creates a radio button that has the specified text, image, and selection state.