jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "button "Enter" key" Watch "button "Enter" key" New topic
Author

button "Enter" key

Vijay Vaddem
Ranch Hand

Joined: Feb 13, 2004
Posts: 243
Hi All,

I have a screen with couple of text fields and buttons.
once the user enters the values in the text fields,
"he moves on to the OK button using tab key" and presses Enter key.

Once he press the enter key, the actionListener method of OK button
should be invoked as if he clicked on that button.

Can anyone help pls...?

Vijay
sasi kala
Ranch Hand

Joined: Dec 17, 2004
Posts: 68
Hi,

in key listener use,it will call the actionPerformed method

All The Best
Mikie Williams
Greenhorn

Joined: Jan 11, 2005
Posts: 7
you could also do
getRootPane().setDefaultButton(button1)
so that the user doesn't even have to tab to the ok button . He just has to hit enter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: button "Enter" key
 
Similar Threads
Dialog Input Question
How to submit multiple records in one trip
enabling push button with key listener
A KeyListener problem
basic doubt