日期:2014-05-20  浏览次数:20694 次

java中怎么样在另一个线程中更新界面的数据
例如界面上有一个Text,我另一个线程从别的地方得到数据,想在界面上更新text控件的值,


------解决方案--------------------
在run方法中更新
class TestThread implements Runnable {
JTextArea textArea;
public TestThread (JTextArea textArea) {
this.textArea = textArea;
}

public void run() {
...
textArea.append( "xxx "); // 此处更新
}
}
------解决方案--------------------
用内部类更方便啦


------解决方案--------------------
$ zz╭ ╮╭ ﹌╮. $
$ z(o-.-o)(o-.-o) . $
$ ┏~﹊︸ ̄~﹊︸ ̄~┓ $
$ IT者-IT开发者的网站-- $
$ 10万篇技术资料--天天更新 $
$ -----www.itzhe.cn----- $