Another approach for showing multiple panels would be to use the CardLayout layout manager.