• Post Reply Bookmark Topic Watch Topic
  • New Topic

Any way to know when frame/components ready for showing?

 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an app that takes a bit to load the components before they can be shown. So I want to show a splash screen beforehand. The problem is I've been estimating how long it takes to load all the components, and showing the splash screen for that time. But of course, this time is different on every computer. Is there any way (listeners?) to be notified when a frame is ready to be visible? (and when its components are ready too?)
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone?
 
Brian Pipa
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Off the top of my head...heare's one way to do it....
WhHen your app starts up, display a "Please wait" type dialog - maybe even kick off a thread and use a progress bar that just goes back and forth. Now start your other initialization stuff and as soon as it's done, hide the please wait dialog and show your new window.
Brian
 
Robert Paris
Ranch Hand
Posts: 585
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you misunderstood my question. My question is: how do I know when the loading of Swing components is done? When I create a JFrame and all it's components and set it visible, it's not instantaneous - it takes a few seconds for the JVM to map everything to native screen resoueces. So for that time, nothing is on the screen. I want to know, how can I be notified of "everything is now mapped to native screen resources and will appear on screen."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!