add remove JPanels from JFrame
Correct me if I'm wrong but you are trying to put several GUI-elements (JPanels perhaps) on the same JFrame?
What you need to do is first remove the current JPanel from the JFrame with the panel on it. Next add the new JPanel to the JFrame, easy as that!!!! See example below:
Not sure if the repaint is necessary, check that out. Let us know if one of the solutions works
public void switchPanel(JPanel sourcePanel, JPanel targetPanel)