很菜的问题,谢谢大家帮忙。
package awttest;
import java.awt.*;
import java.awt.event.*;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class TestCard implements MouseListener{
Panel p1,p2;
Label l1,l2;
Button b1,b2;
CardLayout mycard;
Frame f;
public static void main(String[] args) {
TestCard ct=new TestCard();
ct.init();
}
public void init(){
f=new Frame ("card test");
mycard=new CardLayout();
f.setLayout(mycard);
p1=new Panel();
p2=new Panel();
l1=new Label("this is the first panel");
b1=new Button("show page2");
b1.addMouseListener(this) ;
p1.setBackground(Color.yellow ) ;
p1.add(l1);
p1.add(b1) ;
l2=new Label("this is the second panel");
b2=new Button("show page1");
b2.addMouseListener(this);
p2.setBackground(Color.green ) ;
p2.add(l2) ;
p2.add(b2) ;
f.add(p1,"first") ;
f.add(p2,"second");
mycard.show(f,"first");
f.setSize(200,200) ;
f.setVisible(true) ;
}
public void mouseclicked(MouseEvent e){
mycard.next(f);
}
public void mouseEntered(MouseEvent e){}
public void mouseEvent(MouseEvent e){}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
}
错误提示是:Class awttest.TestCard should be declared abstract,it dose not define method mouseExited(java.awt.event.MouseEvent)in interface java awt.event.MouseListener at line 14