CardLayout showing two panels, flashing
Here’s a problem: final Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { Don’t use a java.util.Timer in a Swing program as you will have threading problems. Instead use a Swing Timer. Also, you’re making Swing calls in background threads and using Graphics object obtained by calling getGraphics() on a component, two no-nos for Swing programs. … Read more