Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Arrow Keys
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
eclipto




PostPosted: Fri Nov 24, 2006 6:15 pm   Post subject: Arrow Keys

Does anyone know how to move objects drawn in a paint method with the arrow keys Question
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Fri Nov 24, 2006 6:44 pm   Post subject: (No subject)

Well, your class has the positions of the objects as instance variables. Your paint method uses this information to paint them on the canvas.

So your real question is how you change that information in response to a keypress. Smile

The solution lies in understanding KeyListeners.
eclipto




PostPosted: Fri Nov 24, 2006 6:48 pm   Post subject: (No subject)

Would it be possible for you to explain keyListener to me? i havent been taught this area yet
wtd




PostPosted: Fri Nov 24, 2006 6:51 pm   Post subject: (No subject)

I would, but there are already many many explanations readily available, and just a Google search away.

Also, understanding interfaces and anonymous inner classes will help tremendously. You can find explanations of these concepts in my Intoduction to Java in the [Java Tutorials] forum.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: