< prev index next >

test/jdk/java/awt/Toolkit/Headless/HeadlessToolkit.java

Print this page


   1 /*
   2  * Copyright (c) 2007, 2014, 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  */


 101         exceptions = false;
 102         try {
 103             ColorModel cm = tk.getColorModel();
 104         } catch (HeadlessException e) {
 105             exceptions = true;
 106         }
 107         if (!exceptions)
 108             throw new RuntimeException("HeadlessException did not occur when expected");
 109 
 110         exceptions = false;
 111         try {
 112             int km = tk.getMenuShortcutKeyMask();
 113         } catch (HeadlessException e) {
 114             exceptions = true;
 115         }
 116         if (!exceptions)
 117             throw new RuntimeException("HeadlessException did not occur when expected");
 118 
 119         exceptions = false;
 120         try {









 121             boolean state = tk.getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
 122         } catch (HeadlessException e) {
 123             exceptions = true;
 124         }
 125         if (!exceptions)
 126             throw new RuntimeException("HeadlessException did not occur when expected");
 127 
 128         exceptions = false;
 129         try {
 130             boolean state = tk.getLockingKeyState(KeyEvent.VK_NUM_LOCK);
 131         } catch (HeadlessException e) {
 132             exceptions = true;
 133         }
 134         if (!exceptions)
 135             throw new RuntimeException("HeadlessException did not occur when expected");
 136 
 137         exceptions = false;
 138         try {
 139             boolean state = tk.getLockingKeyState(KeyEvent.VK_KANA_LOCK);
 140         } catch (HeadlessException e) {


   1 /*
   2  * Copyright (c) 2007, 2017, 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  */


 101         exceptions = false;
 102         try {
 103             ColorModel cm = tk.getColorModel();
 104         } catch (HeadlessException e) {
 105             exceptions = true;
 106         }
 107         if (!exceptions)
 108             throw new RuntimeException("HeadlessException did not occur when expected");
 109 
 110         exceptions = false;
 111         try {
 112             int km = tk.getMenuShortcutKeyMask();
 113         } catch (HeadlessException e) {
 114             exceptions = true;
 115         }
 116         if (!exceptions)
 117             throw new RuntimeException("HeadlessException did not occur when expected");
 118 
 119         exceptions = false;
 120         try {
 121             int km = tk.getMenuShortcutKeyMaskEx();
 122         } catch (HeadlessException e) {
 123             exceptions = true;
 124         }
 125         if (!exceptions)
 126             throw new RuntimeException("HeadlessException did not occur when expected");
 127 
 128         exceptions = false;
 129         try {
 130             boolean state = tk.getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
 131         } catch (HeadlessException e) {
 132             exceptions = true;
 133         }
 134         if (!exceptions)
 135             throw new RuntimeException("HeadlessException did not occur when expected");
 136 
 137         exceptions = false;
 138         try {
 139             boolean state = tk.getLockingKeyState(KeyEvent.VK_NUM_LOCK);
 140         } catch (HeadlessException e) {
 141             exceptions = true;
 142         }
 143         if (!exceptions)
 144             throw new RuntimeException("HeadlessException did not occur when expected");
 145 
 146         exceptions = false;
 147         try {
 148             boolean state = tk.getLockingKeyState(KeyEvent.VK_KANA_LOCK);
 149         } catch (HeadlessException e) {


< prev index next >