javaswingjframe

How can I refresh or reload the JFrame?


I am doing project using Java and in that I need to reload whole JFrame after clicking particular button on that JFrame. How to do this?


Solution

  • Try

    SwingUtilities.updateComponentTreeUI(frame);
    

    If it still doesn't work then after completing the above step try

    frame.invalidate();
    frame.validate();
    frame.repaint();