Repaint JPanel doesn't work in JApplet
问题 I have the the main JPanel (in JApplet ) which containts the child JPanel and the button. I want to click the button make the child JPanel removed and another child JPanel added to the main JPanel, but the problem is that only when I reclick the button or adjust the JApplet's size the second child JPanel apprear then. My button's listener : button.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { panel.remove(custompanel); panel.add(new CustomPanel