aspose 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
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: 38348
    
  23
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