在Java Application中更新JLabel [英] update JLabel in Java Application

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

问题描述

我有一个JFrame和一个标签。

按钮点击我有一个循环和thread.sleep(100)我想在每个循环中显示标签的值。然而,文本标签显示相同,直到循环结束然后显示标签的最终结果。

我该如何解决这个问题?

I have a JFrame and a label in it.
on button click i have a loop and thread.sleep(100) and I want to show the value of the label in each loop. However the text label is showing the same until the loop is finished and then displaying the final result of the label.
How can I solve this?

推荐答案

我们不提供代码。



查看此示例: http://www.java2s.com/Code/JavaAPI/javax.swing/SwingUtilitiesinvokeLaterRunnabledoRun.htm [ ^ ]



并开发。这就是开发人员所做的事情。
We do not provide code.

Check this example: http://www.java2s.com/Code/JavaAPI/javax.swing/SwingUtilitiesinvokeLaterRunnabledoRun.htm[^]

and develop. Cuase that's what developers do.


这篇关于在Java Application中更新JLabel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆