Hi everyone, I need help with JPanel
I have a panel named "contentPanel" inside of a Main Frame and I am inserting to that panel another JPanel "MyPanel" from another class with add.()
What I want is to hide that new panel inserted (MyPanel) and insert or show another on top of it, that means I have contentPanel that has MyPanel but in an exact moment, I want it to change to OtherPanel for example (OtherPanel is a panel from another class).contentPanel.setLayout(new BorderLayout(5, 5));
contentPanel.add(MyPanel, BorderLayout.CENTER);
If I do add() with the new panel, it appears in top of MyPanel and all the components from both panels show up, and dont work.
Thanks and hope you understand my english.