This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Unable to retain focus 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 "Unable to retain focus" Watch "Unable to retain focus" New topic
Author

Unable to retain focus

Amaresh Patra
Greenhorn

Joined: Sep 14, 2001
Posts: 8
Hi,
I have a Jbutton in JApplet which I have defined as the default button in the init() method itself. When a popup screen comes above it loses the focus and when the popup is closed the Jbutton is not able to get the focus back eventhough in the dispose event of popup I have used requestfocus()/grabfocus() to get the focus back to the original JButton.
All suggestions are welcome
Amaresh
Lance Finney
Ranch Hand

Joined: Apr 26, 2001
Posts: 133
I'm not sure if this will work for an applet, but putting the requestFocus() call in addNotify() works for Dialogs.
Try code similar to this:
 
jQuery in Action, 2nd edition
 
subject: Unable to retain focus
 
Similar Threads
Check if popup window is already open from parent window?
JMenu
To have only one JFrame at a time
Popup focus
Focus problem in 1.4_2 when JPopupMenu show is called