public class RadioButtonDemo extends JFrame
{
public static void main(String[] args)
{
RadioButtonDemo fr = new RadioButtonDemo("
container;
radioButtonGroup.add(jRadioButton2);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);查询".add(jRadioButton1);
container.add(jRadioButton2).*;
JRadioButton jRadioButton2 = new JRadioButton(");
JRadioButton jRadioButton3 = new JRadioButton("
fr.setVisible(true);Demo"转账");
radioButtonGroup.add(jRadioButton1);););
radioButtonGroup.add(jRadioButton3);取款".add(jRadioButton3);
ButtonGroup radioButtonGroup = new ButtonGroup().swing;
Container container = fr.getContentPane();
fr.setSize(200,120).setLayout(new FlowLayout());
container.add(jLabel);
JRadioButton jRadioButton1 = new JRadioButton("
container;
container;/RadioButtonDemo.java
import java.awt.*;
import javax/
java运行时显示jLabel找不到符号
答案:2 悬赏:0 手机版
解决时间 2021-04-09 13:30
- 提问者网友:雪舞兮
- 2021-04-09 02:12
最佳答案
- 五星知识达人网友:拾荒鲤
- 2021-04-09 02:30
在你的这行“JRadioButton jRadioButton3 = new JRadioButton("转账");
”下面加上jLabel的定义,如下:JLabel jLabel = new Jlabel();
”下面加上jLabel的定义,如下:JLabel jLabel = new Jlabel();
全部回答
- 1楼网友:舊物识亽
- 2021-04-09 03:48
图片的路径,和程序是一个目录么?
等我,用我机器看看
等会,我的jdk有点问题,一会解决了再说哈
确实不好用,不过我给你改了改,这个我测试过,好用了,呵呵,你自己找找毛病,学程序时,要自己研究研究,不能光靠别人,另外这上面的分没有也没啥用吧,我就是最近没有什么项目,闲着无聊来玩玩:
public class frame1 extends jframe {
jlabel jlabel1 = new jlabel();
public frame1(){
jframe f=new jframe("jframedemo");
jpanel contentpane = new jpanel();
contentpane.setname("new pane");
contentpane.setlayout(null);
contentpane.setforeground(java.awt.color.blue);
jlabel1.setbounds(new rectangle(72, 58, 238, 176));
imageicon icon = new imageicon("1.jpeg");
image image = icon.getimage();
image = image.getscaledinstance(jlabel1.getwidth(), -1, image.scale_smooth);
icon.setimage(image);
jlabel1.seticon(icon);
contentpane = (jpanel) getcontentpane();
contentpane.setlayout(null);
setsize(new dimension(400, 300));
settitle("frame title");
jlabel1.settext("jlabel1");
contentpane.add(jlabel1,null);
f.setcontentpane(contentpane);
f.pack();
f.setsize(800,600);
f.show();//使jframe变成可看见的(visible)
}
public static void main(string[] args){
new frame1();
}
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯