开发者

Inventory is not abstract and does not override abstract method

开发者 https://www.devze.com 2023-01-01 02:46 出处:网络
OK so my applet is not compiling and I Googled some answers and none worked. (Such as taking public out of public class)...

OK so my applet is not compiling and I Googled some answers and none worked. (Such as taking public out of public class)...

Here's my code: http://www.so.pastebin.com/MBjZGneg

Heere is my error:

C:\Users\Dan\Documents\DanJavaGen\Inventory.java:12: Inventory is not 开发者_如何学JAVAabstract and does not override abstract method keyReleased(java.awt.event.KeyEvent) in java.awt.event.KeyListener public class Inventory extends Applet implements KeyListener {

... help? :) please.


It means what it says. You are not implementing the keyReleased method. You're also not implementing keyTyped. If you want to keep your current class structure, you can add empty methods:

public void keyReleased(KeyEvent e){} // ignore
public void keyTyped(KeyEvent e){} // ignore

If you put the listener in a separate (possibly inner) class, you could extend KeyAdapter, which provides these empty methods for you.


It's obvious that you need to override the Method "KeyReleased" in your Inventory class. I can't locate such one in your class.

Simply add it to your class and add behavior

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号