• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

window focus  RSS feed

 
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?
 
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?
 
Marshal
Posts: 59765
188
  • 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
Boost this thread!