Results 1 to 2 of 2
  1. #1
    carl is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default Help user interface

    Hi, I need help with a small simple program i am making for java all i need is to do a user interface with they use the arrows on the keyboard not the ones on the num pad on the right.
    Here is a table of what happens when what arrows get pushed down.

    Java Code:
    Left Arrow:x=x-1;
    Right Arrow:x=x+1;
    Up Arrow:y=y+1;
    Down Arrow:y=y-1;
    And the default is that x=0 and y=0 just a simple script is all that i am looking for.
    Thanks.

  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    This is difficult to do from the command line. I assume you are planning on creating a JFrame or some such window to capture events? With swing you can capture keyboard events and map them to what keys were pressed. You can do it by adding a keyboard listener.

Similar Threads

  1. New User
    By TKI5 in forum New To Java
    Replies: 0
    Last Post: 12-13-2007, 01:13 AM
  2. How to get the User Name
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 10-04-2007, 09:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •