I want to back to the main panel in my java application with a jMenuItem, my panels and other stuff are set with a CardLayout. So I have 3 panels and from any of them I want to be able to return to the first panel using this menu item to start a new analysis. I have tried with the property setVisible with no results. Any suggestion? thanks in advance.

The below example may help you.
At first i added the three Jpanels(pnl1,pnl2,pnl3) to JFrame having card layout and it didn't worked and throw error. So instead i created one more panel (pnlMain) with cardlayout and added all the three panels. And now it worked fine on menu item click event.