This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes button Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply 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://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: button "Enter" key
 
Similar Threads
Dialog Input Question
basic doubt
How to submit multiple records in one trip
enabling push button with key listener
A KeyListener problem