注册 登录
编程论坛 JAVA论坛

error:can not find symbol JLable

Yangzetao 发布于 2017-07-12 09:55, 1925 次点击
程序代码:
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编辑过]

2 回复
#2
林月儿2017-07-12 10:02
JLable -》 JLabel
#3
Yangzetao2017-07-12 10:14
回复 2楼 林月儿
晕死 ,我还到处找,以为大小写正确了怎么还错误,谢谢了。。。
1