diff options
author | Carolyn MacLeod <carolyn> | 2008-01-31 22:03:05 +0000 |
---|---|---|
committer | Carolyn MacLeod <carolyn> | 2008-01-31 22:03:05 +0000 |
commit | 0fee062424c927acf1e0e0389ddd5c6943ce6f58 (patch) | |
tree | 6114c14c9ef7143af37234174473341afa42fa2a | |
parent | b9424a5bc4808483b5f0287d91bb9a21a656b499 (diff) | |
download | eclipse.platform.swt-0fee062424c927acf1e0e0389ddd5c6943ce6f58.tar.gz eclipse.platform.swt-0fee062424c927acf1e0e0389ddd5c6943ce6f58.tar.xz eclipse.platform.swt-0fee062424c927acf1e0e0389ddd5c6943ce6f58.zip |
*** empty log message ***
-rw-r--r-- | examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java new file mode 100644 index 0000000000..eb91c12670 --- /dev/null +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet290.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.snippets; + +/* + * Canvas snippet: ignore 2nd mouse up event after double-click + * + * For a list of all SWT example snippets see + * http://www.eclipse.org/swt/snippets/ + */ + +import org.eclipse.swt.widgets.*; +import org.eclipse.swt.events.*; + +public class Snippet290 { + +public static void main(String [] args) { + final Display display = new Display(); + final Shell shell = new Shell(display); + shell.addMouseListener(new MouseAdapter() { + public void mouseUp(MouseEvent e) { + if (e.count == 1) { + System.out.println("Mouse up"); + } + } + public void mouseDoubleClick(MouseEvent e) { + System.out.println("Double-click"); + } + }); + shell.setBounds(10, 10, 200, 200); + shell.open (); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) display.sleep(); + } + display.dispose(); +} +} |