< prev index next >

test/jdk/java/awt/event/MouseEvent/MouseButtonsAndKeyMasksTest/MouseButtonsAndKeyMasksTest.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 175 
 176         int buttonsEx[] = new int[]{
 177             InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK};
 178 
 179         String OS = System.getProperty("os.name").toLowerCase();
 180         System.out.println(OS);
 181 
 182         int keyMods[], keyModsEx[], keys[];
 183 
 184 
 185         if (OS.contains("linux")) {
 186             keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK};
 187             keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK};
 188             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL};
 189         } else if (OS.contains("os x")) {
 190             keyMods = new int[]{
 191                 InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK, InputEvent.META_MASK};
 192             keyModsEx = new int[]{
 193                 InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK, InputEvent.META_DOWN_MASK};
 194             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META};
 195         } else if (OS.contains("sunos")) {
 196             keyMods   = new int[]{InputEvent.SHIFT_MASK, InputEvent.META_MASK};
 197             keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.META_DOWN_MASK};
 198             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_META};
 199         } else {
 200             keyMods = new int[]{
 201                 InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK};
 202             keyModsEx = new int[]{
 203                 InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK};
 204             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT};
 205         }
 206 
 207 
 208         ArrayList<Component> components = new ArrayList();
 209         components.add(button);
 210         components.add(buttonLW);
 211         components.add(textField);
 212         components.add(textArea);
 213         components.add(list);
 214         components.add(listLW);
 215 
 216         for (Component c: components) {
 217 
 218             System.out.println(c.getClass().getName() + ":");


   1 /*
   2  * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 175 
 176         int buttonsEx[] = new int[]{
 177             InputEvent.BUTTON1_DOWN_MASK, InputEvent.BUTTON2_DOWN_MASK, InputEvent.BUTTON3_DOWN_MASK};
 178 
 179         String OS = System.getProperty("os.name").toLowerCase();
 180         System.out.println(OS);
 181 
 182         int keyMods[], keyModsEx[], keys[];
 183 
 184 
 185         if (OS.contains("linux")) {
 186             keyMods = new int[]{InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK};
 187             keyModsEx = new int[]{InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK};
 188             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL};
 189         } else if (OS.contains("os x")) {
 190             keyMods = new int[]{
 191                 InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK, InputEvent.META_MASK};
 192             keyModsEx = new int[]{
 193                 InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK, InputEvent.META_DOWN_MASK};
 194             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT, KeyEvent.VK_META};




 195         } else {
 196             keyMods = new int[]{
 197                 InputEvent.SHIFT_MASK, InputEvent.CTRL_MASK, InputEvent.ALT_MASK};
 198             keyModsEx = new int[]{
 199                 InputEvent.SHIFT_DOWN_MASK, InputEvent.CTRL_DOWN_MASK, InputEvent.ALT_DOWN_MASK};
 200             keys = new int[]{KeyEvent.VK_SHIFT, KeyEvent.VK_CONTROL, KeyEvent.VK_ALT};
 201         }
 202 
 203 
 204         ArrayList<Component> components = new ArrayList();
 205         components.add(button);
 206         components.add(buttonLW);
 207         components.add(textField);
 208         components.add(textArea);
 209         components.add(list);
 210         components.add(listLW);
 211 
 212         for (Component c: components) {
 213 
 214             System.out.println(c.getClass().getName() + ":");


< prev index next >