I have a project with a lot of panels. I have one method that switches the card (jpanel) in a card layout panel (see below). This all works fine when I run it from my IDE (Netbeans) and when I run the jar from command prompt (java -jar MyStuff.jar
). But when I double click the Jar the card changes but doesn't repaint
producing undesireable results (when I mouse over the components appear). If I call the method again by clicking the button again it'll apply. I need help immediately please :) Thanks!
/**
* Shows a panel by the given panel name (in the cardPanel)
*
* @param panelName
*/
private void showPanel(String panelName) {
if (panelName.equals("revenueSources")) {
backButtonIcon.setVisible(false);
} else {
backButtonIcon.setVisible(true);
}
currentPanelName = panelName;
((CardLayout) cardPanel.getLayout()).show(cardPanel, panelName);
repaint();
revalidate();
}