Unexpected behavior Thread.sleep() is used within CardLayout
I am trying to display two panels after each other using CardLayout. Here is a method:
public void initComponents()
CardLayout cl = new CardLayout();
} catch (InterruptedException ie)
System.out.println("Caught " + ie.getClass());
From my perspective, the program should show welcomePanel for 3 seconds and then exit. On the contrary, no gui is ever displayed. Program runs for 3 seconds and exits. Is there any good explanation to this?
P.S. In case I comment out try-catch and System.exit(0) statements, welcomePanel is displayed as expected