I want to replace a Jpanel with another one in a JFrame I already search and try my code but nothing\'s happen this is my code :
public class Frame extends
you need to do like this :
public void actionPerformed(ActionEvent e) {
//System.out.println("in");
contain = getContentPane();
contain.removeAll();
//System.out.println("in2");
reChange2 = new JPanel(null);
reChange2.setBackground(Color.white);
reChange2.setSize(240, 225);
reChange2.setBounds(50, 50, 240, 225);
//System.out.println("in3");
contain.add(reChange2);
validate();
repaint();
//System.out.println("in4");
setVisible(true);
//System.out.println("in5");
}
});