Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Smart Splash screen  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • 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)
 
Richard Quist
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • 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....
 
clio katz
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • 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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!