• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

window focus

 
Deyna Cegielski
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there a method to bring a window that is in the background to the front?
 
Tal Nathan Tal Nathan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48382
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic