aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Focus 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 "Focus" Watch "Focus" New topic
Author

Focus

red goliath
Greenhorn

Joined: Nov 23, 2001
Posts: 15
Hi ,
i have created a login window with userid and password field in Swing.
i validate these fields and pop up an error message.
If an user leaves password field blank, a message window is displayed with message " please enter password".Now i want the following functionality to be achieved.On click of ok button in message window the focus should return to password field in Login window. how can this be done?
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

"Red Goliath",

Please read the JavaRanch Official User-Name Policy and re-register with a name that follows them. ( No obviously fake user-names... )

Use the requestFocus() method of the JPassword field to return focus to it in the listener for the closing of the error dialog.

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Focus
 
Similar Threads
how to focus input field in jsp without using javascript
How to add a new window on existing one
how to make a text field have cursor flushing
Two windows get focus in turn depends on user action?
how do I change the focus?