diff options
author | Carolyn MacLeod | 2009-04-29 07:44:41 +0000 |
---|---|---|
committer | Carolyn MacLeod | 2009-04-29 07:44:41 +0000 |
commit | 2d09b39447452ab0266bfc801dea85239f407813 (patch) | |
tree | f168f2eb5ee6a25cca6b62fc460f4c6b8e8e992e /examples/org.eclipse.swt.snippets | |
parent | 2a43aaa776776f81917e114e6a9f760cbed562ab (diff) | |
download | eclipse.platform.swt-2d09b39447452ab0266bfc801dea85239f407813.tar.gz eclipse.platform.swt-2d09b39447452ab0266bfc801dea85239f407813.tar.xz eclipse.platform.swt-2d09b39447452ab0266bfc801dea85239f407813.zip |
Document how to close shell (useful info for SnippetLauncher)
Diffstat (limited to 'examples/org.eclipse.swt.snippets')
-rw-r--r-- | examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java index 0e7f31cb34..71a4a355e4 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet180.java @@ -12,6 +12,7 @@ package org.eclipse.swt.snippets; /* * Create a non-rectangular shell to simulate transparency + * (ESC to close shell) * * For a list of all SWT example snippets see * http://www.eclipse.org/swt/snippets/ @@ -52,6 +53,13 @@ public static void main(String[] args) { e.gc.drawImage(image, 0, 0, bounds.width, bounds.height, 10, 10, size.x-20, size.y-20); } }); + shell.addListener(SWT.KeyDown, new Listener() { + public void handleEvent(Event e) { + if (e.character == SWT.ESC) { + shell.dispose(); + } + } + }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) |