File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Threads and Synchronization and the fly likes Splash Screen Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Splash Screen" Watch "Splash Screen" New topic
Author

Splash Screen

Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
Hi,
I'm trying to create a program that will have a Splash Screen and I have 2 threads, one to start the program and one to display the splash screen. After the splash screen is no longer being displayed I want the thread to no longer run. How can I make sure this will happen? This is my first attempt at a multi-threaded application.
Thanks.


SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Once the run() method exits normally, the thread dies a "natural death". Do NOT use the stop() method since it's depracated.
You can check wether the thread is dead or alive with the isAlive() method. This will return false if the thread is dead, OR if the thread is new and not runnable. For example, this would be a new and not runnable thread:

In this case, isAlive() returns false.
Once you do this,

the thread is NOT new, it's runnable (even if it hasn't had the chance to start running), and isAlive() returns true.
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
Ok, I thought that was what would happen, but I wasn't sure if it was still taking resources or not.
Thanks.
 
 
subject: Splash Screen
 
Threads others viewed
Displaying a JWindow
Launching a Java app from the desktop.
options in jar files....
Smart Splash screen
JFrame Calls..
developer file tools