|
-
September 27th, 1999, 05:40 AM
#1
How can I get pressed key in Java like getch() in C or C++
System.in.read() method give string at one time, and don't give anything until I press Enter. I need something like getch() in C.
-
September 29th, 1999, 07:24 AM
#2
Re: How can I get pressed key in Java like getch() in C or C++
Use java.lang.System.in.read() function in try catch block
-
October 4th, 1999, 06:42 PM
#3
Re: How can I get pressed key in Java like getch() in C or C++
If you are not using a DOS environment or such and want to catch key presses in say a windowed application or an applet, you can use the deprecated keyDown() or keyUp() methods. Or, you could implement the KeyListener interface and utilize the keyPressed(), keyReleased(), and keyTyped() methods. Just a thought. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|