0
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 domain.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
CeciliA
  • 45
  • 1
  • 9

1 Answers1

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

This should do the job.

EDIT

JFrame hints at Swing, so it seems Swing Timer will be appropriate. – PM 77

Nicholas
  • 1,883
  • 21
  • 39
  • 1
    `JFrame` hints at `Swing`, so it seems [`Swing Timer`](https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) will be appropriate. – PM 77-1 Sep 27 '16 at 02:51