File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes window focus Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "window focus" Watch "window focus" New topic
Author

window focus

Deyna Cegielski
Ranch Hand

Joined: Nov 24, 2004
Posts: 60
is there a method to bring a window that is in the background to the front?
Tal Nathan Tal Nathan
Greenhorn

Joined: Feb 26, 2006
Posts: 13
Look in the api but there is a way to set a window to be always on top I think you use setAlwaysOnTop(true); in your JFrame.

Would show(); not bring it to the front as well?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
No, show() won't bring it to the front. You oughtn't to use show() at all, but setVisible(true).

I think you were correct in your first suggestion; there is a method in the API; it is called toFront(). There are several like that, toFront(), toBack(), and setAlwaysOnTop(boolean), which will have your Window on top all the time, which is probably not what you want.

While you're in the API, have a look at the related java.awt.Component.requestFocus() methods.

CR
[ April 19, 2006: Message edited by: Campbell Ritchie ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: window focus
 
Similar Threads
parent window refresh
how many remaining?
how do close mozilla window?
WA #1.....word association
Opening a popup on another machine