diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java index ee913cebe98..d13d819e163 100644 --- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java +++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet62.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2025 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -40,12 +40,12 @@ public static void main (String [] args) { final Shell shell = new Shell (display); shell.setText("Snippet 62"); Listener listener = e -> { - String string = "Unknown"; - switch (e.type) { - case SWT.MouseDown: string = "DOWN"; break; - case SWT.MouseMove: string = "MOVE"; break; - case SWT.MouseUp: string = "UP"; break; - } + String string = switch (e.type) { + case SWT.MouseDown -> "DOWN"; + case SWT.MouseMove -> "MOVE"; + case SWT.MouseUp -> "UP"; + default -> "Unknown"; + }; string +=": button: " + e.button + ", "; string += "stateMask=0x" + Integer.toHexString (e.stateMask) + stateMask (e.stateMask) + ", x=" + e.x + ", y=" + e.y; if ((e.stateMask & SWT.BUTTON1) != 0) string += " BUTTON1";