• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Smart Splash screen

 
clojure forum advocate
Posts: 3479
Mac Objective C Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.
I know how to make a splash screen (using java), but how to create a splash
screen that really takes the time that the application needs to initialize itself (like jbuilder's splash and deploytool's splash)
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done very little with Swing, so this may be a stupid question, but is there any reason you can't put your initialization code in a method, call that method and then destroy the splash screen when the method is complete?
Alternatively, you could put your initialization code in a second thread. Your main code could display the splash screen, start the second thread to handle initialization, call join() on the second thread (so the main code waits until the initialization thread has completed) and then destroys the splash screen....
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At init time, the threading of GUI stuff is a little hairy because of the way Swing wants to deal with event+paint code one thread at a time (lots of articles about this, see google on 'SwingWorker').
so i had a similar problem trying to get a 'smart' splash. i did implement a splash using Richard's second suggestion ('main' displays splash, then threads-out initialization tasks, then synchs up everything). This method works as long as you keep in mind that Swing will resist simultaneous event/paint ops amongst threads.
that said, in a later impl i tried using ProgressMonitor (see sun tutorial http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html#monitors) ... which is nice too. this component facilitates tying the actual init progress to the visual indicator. (note that the example 'solves' the Swing single-threading issue using the SwingWorker class:-)
Good Luck!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic