如何刷新或重新加载 JFrame?

2022-01-24 00:00:00 java swing jframe

我正在使用 Java 进行项目,因此我需要在单击该 JFrame 上的特定按钮后重新加载整个 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?

推荐答案

试试

SwingUtilities.updateComponentTreeUI(frame);

如果还是不行,那么在完成上述步骤后尝试

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

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

相关文章