Originally posted by pete stein:
I'm confused. Isn't putting dialog.dispose() within the dialog's windowClosing method a bit redundant? It's already going to close without this method (unless I'm missing something basic here).
Actually the default behaviour is hide the dialog, not dispose it. To dispose by default you'll have to call setDefaultCloseOperation(DISPOSE_ON_CLOSE) first.
Ravikanth, you'll need a boolean flag inside the loop as well that will be set to false by the closing. Most likely you'll have to create a method for setting it to false. Something like
<blockquote>
code:
<pre name="code" class="core">
for (int i = 0; running && i < 10000; i++)
{
text.append(i);
dialog.validate();
}</pre>
</blockquote>
The window adapter will then set running to false through some method you'll have to create.