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编辑过]