i want to switch content of jpanels.lets say i have jpanel1 and jpanel2 and i want to change content of jpanel1 to jpanel2 and also jpanel2 to jpanel1.those panels have completely different content .so i can't change properties of jpanel and all elements instead switch.this image for clarify
void switchPanels (){
Content c1=jPanel1.getContent();
jPanel1.setContent(jPanel2.getContent());
jPanel2.setContent(c1);
}
i know above codes not work .i want to know how can i implement this .