更好的方法是启动计时器,并且使计时器不时地提醒事件线程去查看中间区域,以寻找更新。
A better approach is to start a timer, and have timer poke the event thread every so often to go look at the staging area for updates.
如果你需要一个延迟,这样,使用摆动定时器,所以你不要关闭事件线程在睡眠。
If you need a delay like this, use a Swing Timer so you don't shut down the event thread during the sleep.
由于JSR 172中的远程调用是按模块进行的,而且如果在主事件线程中调用,用户界面会冻结,直到远程调用结束。
This is because remote invocations in JSR 172 are blocking calls, and if invoked in the main event thread, the user interface will freeze until the remote invocation completes.
应用推荐