I have 3 panels in the frame, panel, panel1, panel2. When I click on the button it doesn't remove the panel from the frame.
private class ButtonListener implements ActionListener
{
public void actionPerformed (ActionEvent e)
{
// some stuffs here.
++current;
frame.remove(panel1);
frame.revalidate();
frame.repaint();
}
}
edit: i used this too but it doesn't work as well
frame.remove(panel1);
frame.getContentPane().invalidate();
frame.getContentPane().validate();
frame.getContentPane().repaint();