wood burning stoves
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: coding for response to enter button on keyboard
 
It's not a secret anymore!