File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes wanted help in the practice program-- Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "wanted help in the practice program--"Cycling"" Watch "wanted help in the practice program--"Cycling"" New topic

wanted help in the practice program--"Cycling"

Deepakk Verma
Ranch Hand

Joined: Sep 09, 2009
Posts: 31
I made this code as a practice exercise......this program should be controlled with simply four
cursor control keys and each key must be assigned a method.....i.e., by pressing a particular
key some operation must be performed....what this program do is it should just reflects the changes in the distance traveled and speed of cycle by accelerating and decelerating the cycle and it should also change direction of the cycle(of course imaginary one since i haven't reached to the topics using graphics) stated below

right cursor key(-->) : turnLeft().....and should change the direction as per the code
left cursor key(<--) : turnRight()....and should change the direction as per the code
up cursor key(<) : paddleMoving(int i) 'i' states for number of paddle rounds user
wants to apply which would be asked in the starting of the program
down cusor key : applyBrakes()......which eventually stops the cycle.

but the problem is that i dont know how to use Scanner for cursor keys...therefore i have left the class containing main() method.....Please help

K. Tsang

Joined: Sep 13, 2007
Posts: 3134

How are you planning to run the program? Swing or console? If console using Scanner to get inputs of what arrow keys are pressed? If Swing hence graphics ... KeyEvent will suit your needs.

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
I agree. Here's the link:
subject: wanted help in the practice program--"Cycling"
It's not a secret anymore!