Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-04-2008, 02:05 AM
Member
 
Join Date: Feb 2008
Posts: 2
Prometheus is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-04-2008, 01:20 PM
Member
 
Join Date: Jan 2008
Posts: 6
Sathish is on a distinguished road
to start with U can use a thread !
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 02-04-2008, 05:05 PM
Member
 
Join Date: Feb 2008
Posts: 2
Prometheus is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting each character from keyboard Sreejesh25 New To Java 8 04-08-2008 04:39 AM
getting each character from keyboard Sreejesh25 Advanced Java 1 04-02-2008 06:31 PM
Assign a keyboard key to a JButton. gszauer AWT / Swing 1 12-15-2007 11:42 PM
Help with keyboard events? Bibendum New To Java 2 11-02-2007 03:51 AM
how to take input and verify input in Java programs bilal_ali_java Advanced Java 0 07-21-2007 09:46 AM


All times are GMT +3. The time now is 04:17 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org