Topic: 小弟求救!(aaa is not abstract and does not override abstract method) |
Print this page |
1.小弟求救!(aaa is not abstract and does not override abstract method) | Copy to clipboard |
Posted by: sss6586576 Posted on: 2004-10-10 10:08 { 请尽量用准确的文字描述作为标题 } 小弟求救!弄了一个上午,也不知是咋回事. import java.awt.*; import java.applet.*; import java.awt.event.*; public class aaa extends Applet implements WindowListener/*,ActionListener*/ { public aaa() { super(); Panel p=new Panel(); Button b1=new Button(); Button b2=new Button(); Button b3=new Button(); TextField t=new TextField(10); b1.setLabel("1"); b2.setLabel("2"); b3.setLabel("+"); /*b1.addActionListener(this);???????为什么不让俺注册呢!!! b2.addActionListener(this); b3.addActionListener(this);*/ p.add(b1); p.add(b2); p.add(b3); add; add; p.setVisible(true); } public void windowClosing(WindowEvent aaa){System.exit(1);} public void windowOpened(WindowEvent e){} public void windowIconified(WindowEvent e){} public void windowDeiconified(WindowEvent e){} public void windowClosed(WindowEvent e){} public void windowActivated(WindowEvent e){} public void windowDeactivated(WindowEvent e){} /*public void actionPerformed(ActionEvent e, Object O) { String s; int n; s=e.getActionCommand(); */ 请问e.getsource怎么用呀?? 谢谢各位大侠.小弟已经抓狂了!!!! G:\java\11\aaa.java:6: aaa is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener public class aaa extends Applet implements WindowListener,ActionListener 这到底是什么意思呀???我就是不懂呀.哪位大侠能帮帮我呀!谢谢!!!!!!!!!!!!!!!!!!!!!!!! |
2.Re:小弟求救!弄了一个上午,也不知是咋回事. [Re: sss6586576] | Copy to clipboard |
Posted by: archonLing Posted on: 2004-10-10 10:16 you have the wrong signature for actionpPerform(). you have ActionEvent, Object). However, it need to have "public void actionPerformed(ActionEvent e)" like the compiler message says. |
3.Re:小弟求救!弄了一个上午,也不知是咋回事. [Re: sss6586576] | Copy to clipboard |
Posted by: sss6586576 Posted on: 2004-10-10 10:23 可以具体一点吗????谢谢了!! |
4.Re:小弟求救!弄了一个上午,也不知是?厥拢?></td></tr><tr class= [Re: sss6586576] | Copy to clipboard |
Posted by: archonLing Posted on: 2004-10-10 10:27
Use "public void actionPerformed(ActionEvent e)" |
5.Re:小弟求救!弄了一个上午,也不知是咋回事. [Re: sss6586576] | Copy to clipboard |
Posted by: caike Posted on: 2004-10-10 13:02 implements WindowListener,ActionListener 意思是实现 WindowListener,ActionListener这两个接口, 所以才可以写成.addActionListener(this); |
6.Re:小弟求救!(aaa is not abstract and does not override abstract method) [Re: sss6586576] | Copy to clipboard |
Posted by: kiffen Posted on: 2004-10-11 17:06 windowListener里面最少有6个抽象函数,如果你要实现功能,通过另外的类实现拾配器 |
7.Re:小弟求救!(aaa is not abstract and does not override abstract method) [Re: sss6586576] | Copy to clipboard |
Posted by: cjyzpcl Posted on: 2004-10-12 14:33 "implements WindowListener"改为"extends WindowAdapter",这样就可以不用全部实现接口WindowListener中的所有方法了。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |