Added proper GUI handling when changing JPanels.