This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Read keypress event in core java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Read keypress event in core java?" Watch "Read keypress event in core java?" New topic
Author

Read keypress event in core java?

Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 88
Hi all,

I wanna read the keys which is pressed by users in core java.

Regards
Ganesan
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
Use a key listener.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19679
    
  18

Which will only work in Swing / AWT. On the command line you can use System.in.read(), although that will usually wait until the user presses enter.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 88
Is that not possible in core Java?

Regards
Ganesan
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
What do you mean by "core Java"? What kind of application are you talking about?


Ping & DNS - my free Android networking tools app
Ganesan Ramakrishnan
Ranch Hand

Joined: Mar 18, 2008
Posts: 88
I mean, i do not want to do it in awt / swing .

regards
Ganesan
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1


On the command line you can use System.in.read(), although that will usually wait until the user presses enter.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Read keypress event in core java?