Wherever you call southPanel.getActiveTab() more than 2 times, create a local var for it.