Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This question is fairly poor, and is not very clear, so I cannot give an exact answer until the question is cleared up.</p> <p>It seems currently that you are using <code>Thread.sleep(500)</code> to cause a delay for 500 milliseconds. In most programs, this will work.</p> <p><code>Thread.sleep(int x)</code> suspends (or freezes, depending on who you ask) the current operation for <code>x</code> milliseconds (in your case, 500 milliseconds).</p> <p>In the application you are using, you are using it to suspend a change in text. Due to it's location, it currently freezes the entire swing box, and it is not recovering.</p> <p>If you HAVE to use <code>Thread.sleep(int x)</code>, then I would recommend that you save the text you are using as a String, then update the <code>TextChangedFrame</code> after you update the String. This allows you to suspend operations, without suspending the <code>TextChangedFrame</code>.</p> <p>PsuedoCode:</p> <pre><code>String oldString = "old string"; String newString = "new string"; // setup your dialog/popup here, with oldString Thread.sleep(500); // modify the dialog/popup here, changing oldString to newString </code></pre> <p>and that should avoid any freezing issues. (which I think, with the question and comments, your problem is).</p> <p><strong>A better solution would be to use <a href="http://docs.oracle.com/javase/1.4.2/docs/api/javax/swing/Timer.html" rel="nofollow noreferrer">Swing Timers</a>, as mentioned by <a href="https://stackoverflow.com/users/522444/hovercraft-full-of-eels">Hovercraft Full Of Eels</a> in <a href="https://stackoverflow.com/questions/16362716/documentlistener-with-thread-sleep#comment23444699_16362716">his comment</a></strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload