This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes coding for response to enter button on keyboard Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "coding for response to enter button on keyboard" Watch "coding for response to enter button on keyboard" New topic
Author

coding for response to enter button on keyboard

Alex Rugav
Greenhorn

Joined: May 03, 2006
Posts: 19
for example, a log on screen, how do you make the logon button respond to the enter button on the keyboard?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

In what context? Swing or a web page?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
I have on my mindreader's turban today (with the big ruby on it) and I'm picking up cosmic vibrations that you are using Swing:

yourFrame.getRootPane().setDefaultButton(yourButton);


There is no emoticon for what I am feeling!
 
Consider Paul's rocket mass heater.
 
subject: coding for response to enter button on keyboard