更新Java小程序的GUI

更新Java小程序的GUI

本文介绍了更新Java小程序的GUI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写在Eclipse的Java小程序。当我在小程序按一下按钮,它应该显示一条消息,但该消息实际上并不会显示出来,直到我与小程序窗口不甘示弱,像调整窗口的大小。有什么我应该在code增加,所以一旦我点击按钮,图形用户界面会自动更新?

I'm writing a Java applet in Eclipse. When I click on the button in the applet, it should display a message, but the message won't actually show up until I fiddle with the applet window, like resizing the window. Is there something I should add in my code, so the GUI automatically updates once I click the button?

推荐答案

通常调用重绘()将采取照顾。



基于MRE的意见,这有更好的信息: Java Swing的重新验证()与重绘()

generally a call to repaint() will take care of that.


based on mre's comments, this has better information: Java Swing revalidate() vs repaint()

这篇关于更新Java小程序的GUI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:29