希望Java高手帮我解决一下。谢谢
import java.awt.*;import java.awt.event.*;
public class useObject extends Frame implements ActionListener
{
static useObject frm = new useObject();
static Panel pan1 = new Panel();
static Panel pan2 = new Panel();
static Button but1 = new Button("第一页");
static Button but2 = new Button("上一页");
static Button but3 = new Button("下一页");
static Button but4 = new Button("最后页");
static CardLayout crd = new CardLayout(5,10);
public static void main(String[] args )
{
frm.setLayout(null) ;
frm.setTitle("操作事件");
pan2.setLayout(new GridLayout(1,4));
pan1.setLayout(crd);
frm.setSize(200,350);
frm.setResizable(false);
but1.addActionListener(frm);
but2.addActionListener(frm);
but3.addActionListener(frm);
but4.addActionListener(frm);
pan1.setBounds(10,20,270,200);
pan2.setBounds(10,220,270,20);
frm.add(pan1);
frm.add(pan2);
Label lab1 =new Label("第一页",Label.CENTER);
TextField tex = new TextField("卡片式布局CardLayout",18);
pan1.add(lab1,"n1");
pan1.add(new Label("第二页",Label.CENTER),"n2");
pan1.add(tex,"n3");
crd.show(pan1,"n3");
pan2.add(but1,"d1");
pan2.add(but2,"d2");
pan2.add(but3,"d3");
pan2.add(but4,"d4");
frm.setVisible(true);
}
public void actionperformed(ActionEvent e)
{
Button but = (Button)e.getSource();
if (but == but1) crd.first(pan1);
else if (but == but2) crd.previous(pan1);
else if (but == but3) crd.next(pan1);
else crd.last(pan1);
}
}
为什么运行时说是useObject类不是抽象类,而且没有覆盖Java.awt.event.listener中的actionperformed()方法啊?希望高手给我解决一下,谢谢。