Thread: Help in Java?
View Single Post
Old
legolizard
Senior Member
 
legolizard's Avatar
 
Status: Offline
Posts: 242
Join Date: Jan 2011
Location: Aboard the Hyperion escaping the zerg.
Default 11-21-2011, 05:01 PM

You have to implement Actionlistener and KeyListener.

So the sig. of your Tuna class should look like this :

Code:
public class Tuna extends JPanel implements ActionListener , KeyListener{
Keep in mind you have to have the appropriate imports to use these interfaces.

Also since they are interfaces you must implement each method that comes with them. For example the KeyListener has three, those being, keyPressed, keyRealeased , and keyTyped and while you may only need keyPressed you still must implement the other two.

Hope this helps!

Also I hate Java doc as well, but it shows how silly the makers of Java are, but then again aren't all programmers a little silly. hehe


"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."-Albert Einstein
   
Reply With Quote