• Post Reply Bookmark Topic Watch Topic
  • New Topic

Two questions on using a splash screen

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




There is no splash screen for this code snippet.
And secondly how do I specify the path of the logo?
this.getClass().getResource().getPath()
and
SplashScreen.class.getResource().getPath();
won't do the job either
Thanks
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Your code is executing on the EDT and the Thread.sleep() blocks the Thread before the GUI can be painted. Read the Swing tutorial on How to Create a Splash Screen for a better solution. Also, check out the section on Concurrency for a better description of the EDT.

2. Also from the tutorial you can read the section on How to Use Icons which explains the way to load an image. I would guess you don't need the leading "/" in you path.

The Swing tutorial covers all the basics.
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:1. Your code is executing on the EDT and the Thread.sleep() blocks the Thread before the GUI can be painted. Read the Swing tutorial on How to Create a Splash Screen for a better solution. Also, check out the section on Concurrency for a better description of the EDT.

2. Also from the tutorial you can read the section on How to Use Icons which explains the way to load an image. I would guess you don't need the leading "/" in you path.

The Swing tutorial covers all the basics.


Thanks Rob, I've solved it by using JSplashScreen.jar
It is in the public domain somewhere.
Thanks
Jack
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!