Computer Science Canada Arrow Keys again |
Author: | eclipto [ Tue Dec 19, 2006 11:58 am ] |
Post subject: | Arrow Keys again |
I have figured out the method for keyPressed,keyReleased, etc but i dont know how do actually return the method. Could someone tell me what do do? ![]() |
Author: | OneOffDriveByPoster [ Tue Dec 19, 2006 11:02 pm ] |
Post subject: | Re: Arrow Keys again |
Call addKeyListener on the component (object) you want to associate your KeyListener with. Your methods need to be in a class that implements the KeyListener interface. Links below should help. http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/KeyAdapter.html http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#addKeyListener(java.awt.event.KeyListener) (Forgive me for not hunting down the topic where this came from if the links, etc. were there already). |