English 中文(简体)
冻结
原标题:Thread.Sleep() is freezing
  • 时间:2012-05-21 17:36:41
  •  标签:
  • java
  • applet

这里是一刀切。

kit.insertHTML(doc, doc.getLength(), "Hello", 0, 0, null);
try{
Thread.sleep(1000);
}catch(Exception e){}

I am using HTMLEditorKit() and HTMLDocument() as a textbox. The textbox should show "Hello" then wait one second however, when I try this, It waits one second then puts the word "Hello" which is not what I want.

我不敢肯定,为什么会发生这种情况,因为我把这一点放在逻辑上。 如果任何人能够帮助我,那将是巨大的。

EDIT:

是否有任何人知道另一种选择,因此我可以使用“延迟”效应?

最佳回答

从Swaing活动范围内传来的“Thread.sleep(......)”,因为这将使活动变得read。 由于这层楼层负责所有绘画和用户互动,因此你的申请将睡觉。

如果你们都想推迟展示,则考虑使用

另一方面,如果一项长期的任务使你的活动变得暗淡,那么就利用一名辛勤工人(如纪尧姆·1+至他所建议的)来完成这项任务。

问题回答

<代码>Thread.sleep是一项长期的任务。 当你在厄立特里亚国防军中执行这项任务时,它排除了所有重新执行的要求。 正在等待并在睡觉阶段发出的所有复方申请都被推迟到以后处理。

因此,EDT源自sleep。 阶段是将所有这类再婚申请(如果能够把共同出售作为缺损财产)合并为一只已执行的复方。 如果无法提供共同销售,那么所有被问到的申请都是在没有时间间隔的情况下按序执行的。 因此,看来统一私法协会没有更新。

为了纠正这种情况,使用了<代码>Swingtimer,该代码在具体时间间隔后定期触发,或<代码>SwingWorker。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签