diff options
author | Carolyn MacLeod | 2004-08-17 19:33:28 +0000 |
---|---|---|
committer | Carolyn MacLeod | 2004-08-17 19:33:28 +0000 |
commit | fa0c2291783e164c88c5af9d897acc8c97e539d8 (patch) | |
tree | fda104fe3f25a5e50c871aa98beea6c78b74a758 /examples | |
parent | e91a7dc0a82046f39682aa6f863e5f222aa1ecfa (diff) | |
download | eclipse.platform.swt-fa0c2291783e164c88c5af9d897acc8c97e539d8.tar.gz eclipse.platform.swt-fa0c2291783e164c88c5af9d897acc8c97e539d8.tar.xz eclipse.platform.swt-fa0c2291783e164c88c5af9d897acc8c97e539d8.zip |
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r-- | examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java index af9500bf98..2becb5ac15 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet56.java @@ -21,29 +21,30 @@ import org.eclipse.swt.widgets.*; public class Snippet56 { -public static void main (String [] args) { - final Display display = new Display (); - Shell shell = new Shell (display); - final ProgressBar bar = new ProgressBar (shell, SWT.SMOOTH); - bar.setBounds (10, 10, 200, 32); - shell.open (); - final int maximum = bar.getMaximum (); - new Thread () { - public void run () { - for (final int [] i=new int [1]; i [0] <= maximum; i [0]++) { + public static void main(String[] args) { + final Display display = new Display(); + Shell shell = new Shell(display); + final ProgressBar bar = new ProgressBar(shell, SWT.SMOOTH); + bar.setBounds(10, 10, 200, 32); + shell.open(); + final int maximum = bar.getMaximum(); + new Thread() { + public void run() { + for (final int[] i = new int[1]; i[0] <= maximum; i[0]++) { try {Thread.sleep (100);} catch (Throwable th) {} - display.asyncExec (new Runnable () { - public void run () { + if (display.isDisposed()) return; + display.asyncExec(new Runnable() { + public void run() { if (bar.isDisposed ()) return; - bar.setSelection (i [0]); - } - }); + bar.setSelection(i[0]); + } + }); + } } - } - }.start (); - while (!shell.isDisposed ()) { + }.start(); + while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep (); + } + display.dispose(); } - display.dispose (); -} -} +}
\ No newline at end of file |