| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1604 人关注过本帖
标题:error:can not find symbol JLable
只看楼主 加入收藏
Yangzetao
Rank: 2
等 级:论坛游民
帖 子:16
专家分:16
注 册:2016-6-6
结帖率:50%
收藏
已结贴  问题点数:20 回复次数:2 
error:can not find symbol JLable
程序代码:
import java.applet.*;
import javax.swing.*;
class MyPanel extends JPanel{
    JButton button1,button2;
    JLable lable;
    MyPanel(String s1, String s2, String s3){
        button1 = new JButton(s1);button2 = new JButton(s2);
        lable = new JLable(s3);
        add(button1);add(button2);add(lable);
    }
}
public class example extends Applet {
    MyPanel panel1,panel2;
    JButton button;
    public  void init(){
        panel1 = new MyPanel("ok","cancel","this is the lable in the first panel.");
        panel2 = new MyPanel("ok","cancel","this is the lable in the second panel.");
        button = new JButton("this is the button that do not belong to any panel");
        add(panel1);add(panel2);add(button);
        setSize(300, 200);
    }
}

编译命令:javac example.java
结果:example.java:8: error: cannot find symbol
    JLable lable;
    ^
  symbol:   class JLable
  location: class MyPanel
example.java:11: error: cannot find symbol
        lable = new JLable(s3);
                    ^
  symbol:   class JLable
  location: class MyPanel
2 errors


[此贴子已经被作者于2017-7-12 10:03编辑过]

搜索更多相关主题的帖子: symbol class lable new add 
2017-07-12 09:55
林月儿
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:湖南
等 级:版主
威 望:138
帖 子:2277
专家分:10647
注 册:2015-3-19
收藏
得分:20 
JLable -》 JLabel

剑栈风樯各苦辛,别时冰雪到时春
2017-07-12 10:02
Yangzetao
Rank: 2
等 级:论坛游民
帖 子:16
专家分:16
注 册:2016-6-6
收藏
得分:0 
回复 2楼 林月儿
晕死 ,我还到处找,以为大小写正确了怎么还错误,谢谢了。。。
2017-07-12 10:14
快速回复:error:can not find symbol JLable
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014576 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved