且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Jframe JLabel,仅当我调整窗口大小时才刷新图像

更新时间:2023-02-05 21:53:27

要更新JFrame,您必须使用

To update a JFrame you must use

revalidate(); 
repaint();

因此,在GUI中进行任何更改后,您都需要revalidate()JFrame,然后重新绘制其内容.

So after you change anything in your GUI you would want to revalidate() the JFrame and then repaint the contents of it.

祝你好运!