• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can i know key pressed

 
aayushpatel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body help me for the following...
I want to Print something on console when enter key pressed...I dont want this from frame or applet that i can do but i want as an application..can any body help me for the above regards...
Thnx in advance
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
IMO, you can only do this by using System.in because listeners are only available for GUI objects: AWT or Swing. You will need to have a BufferedReader like the following:
BufferedReader br = new BufferedReader( System.in );
NOTE: Your name is not a valid JavaRanch name. We want only professional names here at the ranch and yours is not valid. Please read the naming convention here and re-register with a valid name.
Thanks,
Manfred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic