Show splash screen for x amount of seconds

Is there a better way to show a splash screen for x seconds than putting it in a while loop? It just seems so inefficiant and it uses a lot of processing power. This is what I have:long startTime = System.currentTimeMillis();

while(System.getCurrentTimeMillis() <= startTime + 5000){

//wait

}

mainPage.setVisible(true);

[537 byte] By [drawimagea] at [2007-11-27 9:01:49]
# 1
javax.swing.Timer.Also: http://java.sun.com/javase/6/docs/api/java/awt/SplashScreen.html
BigDaddyLoveHandlesa at 2007-7-12 21:31:50 > top of Java-index,Java Essentials,Java Programming...
# 2
You can use Java's new SplashScreen class: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/
prometheuzza at 2007-7-12 21:31:50 > top of Java-index,Java Essentials,Java Programming...
# 3
> javax.swing.Timer.> > Also: > > http://java.sun.com/javase/6/docs/api/java/awt/SplashS> creen.htmlThank you, I knew there had to be a better way.
drawimagea at 2007-7-12 21:31:50 > top of Java-index,Java Essentials,Java Programming...
# 4
> ...> Thank you, I knew there had to be a better way.You're welcome. Note that you will need Java 1.6 for this to work.
prometheuzza at 2007-7-12 21:31:50 > top of Java-index,Java Essentials,Java Programming...