拿JC运行提示说是找不到符号,帮个忙吧,小问题
import java.awt.*;
import java.awt.event.*;
class CardStart
{
public static void main(String[] args)
{
CardTest c=new CardTest("MyCardLayoutTest");
}
}
class CardTest extends Frame
{
private Panel t1=new Panel();
private Panel t2=new Panel();
private Panel t3=new Panel();
private Panel t4=new Panel();
private Panel p1=new Panel();
private Panel p2=new Panel();
private Button b1=new Button();
private Button b2=new Button();
private Button b3=new Button();
private Button b4=new Button();
private Label l1=new Label("The Number 1 CardPage");
private Label l2=new Label("The Number 2 CardPage");
private Label l3=new Label("The Number 3 CardPage");
private Label l4=new Label("The Number 4 CardPage");
public CardTest(String s)
{
super(s);
MyWL mw=new MyWL(this);
myML mm=new myML(this);
this.addWindowListener(mw);
this.addMouseListener(mm);
b1.setSize(30,5);
this.setLayout(new BorderLayout());
this.setSize(500,400);
p2.setSize(500,200);
t1.add(l1);
t2.add(l2);
t3.add(l3);
t4.add(l4);
p1.setLayout(new CardLayout());
p1.add("a",t1);
p1.add("b",t2);
p1.add("c",t3);
p1.add("d",t4);
p2.setLayout(new FlowLayout());
b1.setName("Card1");
b2.setName("Card2");
b3.setName("Card3");
b4.setName("Card4");
p2.add(b1);
p2.add(b2);
p2.add(b3);
p2.add(b4);
p1.setBackground(Color.blue);
p2.setBackground(Color.red);
this.add(p2,BorderLayout.SOUTH);
this.add(p1,BorderLayout.CENTER);
this.setResizable(false);
this.setVisible(true);
}
public void t1show()
{
t1.setVisible(true);
}
public void t2show()
{
t2.setVisible(true);
}
public void t3show()
{
t3.setVisible(true);
}
public void t4show()
{
t4.setVisible(true);
}
}
class MyWL extends WindowAdapter
{
CardTest t;
public MyWL(CardTest ct)
{
t=ct;
}
public void windowClosing(WindowEvent we)
{
t.dispose();
}
}
class myML extends MouseAdapter
{
CardTest t;
public myML(CardTest ct)
{
t=ct;
}
public void mouseClicked(MouseEvent me)
{
if((Button)me.getSource()==b1)
{
t.t1show();
}
else if((Button)me.getSource()==b2)
{
t.t2show();
}
else if((Button)me.getSource()==b3)
{
t.t3show();
}
else if((Button)me.getSource()==b4)
{
t.t4show();
}
else
{
System.out.println("plz choose a card");
}
}
}
我纳闷为什么会在做B1,B2,B3,B4的选择时出这样的错误,搞不懂
谢谢各位大侠了,我是第一次发问