diff options
author | Bogdan Gheorghe <gheorghe> | 2008-02-07 18:21:14 +0000 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe> | 2008-02-07 18:21:14 +0000 |
commit | be182216b30303ec5395fc0f7999dfd536769259 (patch) | |
tree | 219bc25f24b2dd88d6af9c8ec74c2c4fec7bc405 | |
parent | 7637dbac0e310c0a0c9c6afc61f6d60d7792095c (diff) | |
download | eclipse.platform.swt-be182216b30303ec5395fc0f7999dfd536769259.tar.gz eclipse.platform.swt-be182216b30303ec5395fc0f7999dfd536769259.tar.xz eclipse.platform.swt-be182216b30303ec5395fc0f7999dfd536769259.zip |
Tristate Snippet
-rw-r--r-- | examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java new file mode 100644 index 0000000000..299b29ed64 --- /dev/null +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet293.java @@ -0,0 +1,41 @@ +package org.eclipse.swt.snippets; + +/* + * create a tri-state button. + * + * For a list of all SWT example snippets see + * http://www.eclipse.org/swt/snippets/ + */ +import org.eclipse.swt.*; +import org.eclipse.swt.layout.*; +import org.eclipse.swt.widgets.*; + +public class Snippet293 { + + public static void main(java.lang.String[] args) { + Display display = new Display(); + Shell shell = new Shell(display); + shell.setLayout(new GridLayout()); + + Button b1 = new Button (shell, SWT.CHECK); + b1.setText("State 1"); + b1.setSelection(true); + + Button b2 = new Button (shell, SWT.CHECK); + b2.setText("State 2"); + b2.setSelection(false); + + Button b3 = new Button (shell, SWT.CHECK); + b3.setText("State 3"); + b3.setSelection(true); + b3.setGrayed(true); + + shell.pack(); + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + display.dispose(); + } +} |