CeciliA CeciliA - 2 months ago 5
Java Question

How can i call JFrame with another JFrame after 2 Seconds Delay

new SplashDemoGUI().setVisible(true);
try {
Thread.sleep(2000);
new sample().setVisible(true);
} catch (InterruptedException ex) {

}


Maybe someone can help me, I`ve put it in public main. Thanks in Advance.

Answer
new java.util.Timer().schedule( 
    new java.util.TimerTask() {
        @Override
        public void run() {
            new sample().setVisible(true);
        }
    }, 
    2000 
);

This should do the job.

Comments