File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "button "Enter" key" Watch "button "Enter" key" New topic

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...?

sasi kala
Ranch Hand

Joined: Dec 17, 2004
Posts: 68

in key listener use,it will call the actionPerformed method

All The Best
Mikie Williams

Joined: Jan 11, 2005
Posts: 7
you could also do
so that the user doesn't even have to tab to the ok button . He just has to hit enter.
wood burning stoves
subject: button "Enter" key
It's not a secret anymore!