Results 1 to 3 of 3
  1. #1
    Prometheus is offline Member
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Default Polled keyboard input through swing

    Hello!

    A new member here, with a question I have wanted to know the answer to for absolutely ages, and have never found a solution to...

    Is is possible to setup a swing form to handle polled keyboard input. By this, I mean overridding the event model for keyboard input, and instead invoke some "getch()" style method.

    For the current project I have in mind (a game) it is not desirable to for the usual event behavior of keyboard input, (eg keyTyped(), keyPressed(), keyReleased()).

    Instead, I require a method which can be invoked, block execution and then return the keypress. Im not even sure this can be acheived... Any ideas?

  2. #2
    Sathish is offline Member
    Join Date
    Jan 2008
    Posts
    6
    Rep Power
    0

    Default

    to start with U can use a thread !

  3. #3
    Prometheus is offline Member
    Join Date
    Feb 2008
    Posts
    2
    Rep Power
    0

    Default

    Okay, well I have only used threads in a limited capacity so far. Mostly for network client/server implementations. How would I go about this? Im good with most of the Java programming features, but threads are not my strong point (lack of practice). Some pseudocode would be helpful. Im not looking for a coded solution, just a nudge in the right direction!

    Thanks

Similar Threads

  1. getting each character from keyboard
    By Sreejesh25 in forum New To Java
    Replies: 11
    Last Post: 01-25-2011, 01:08 PM
  2. getting each character from keyboard
    By Sreejesh25 in forum Advanced Java
    Replies: 6
    Last Post: 03-05-2010, 07:12 PM
  3. Assign a keyboard key to a JButton.
    By gszauer in forum AWT / Swing
    Replies: 1
    Last Post: 12-15-2007, 10:42 PM
  4. Help with keyboard events?
    By Bibendum in forum New To Java
    Replies: 2
    Last Post: 11-02-2007, 02:51 AM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

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