Construct a new key description from a given universal string description
/* * $Id: Utilities.java,v 1.11 2008/10/14 22:31:46 rah003 Exp $ * * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, * Santa Clara, California 95054, U.S.A. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.awt.Component; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.Insets; import java.awt.KeyboardFocusManager; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.KeyEvent; import java.lang.ref.Reference; import java.lang.ref.SoftReference; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.text.BreakIterator; import java.util.ArrayList; import java.util.HashMap; import java.util.Locale; import java.util.NoSuchElementException; import java.util.StringTokenizer; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.KeyStroke; import javax.swing.SwingUtilities; /** * Contribution from NetBeans: Issue #319-swingx. *
* * PENDING: need to reconcile with OS, JVM... added as-is because needed the * shortcut handling to fix # * * @author apple */ public class Utilities { private Utilities() { }
private static final int CTRL_WILDCARD_MASK = 32768; private static final int ALT_WILDCARD_MASK = CTRL_WILDCARD_MASK * 2;
/** Operating system is Windows NT. */ public static final int OS_WINNT = 1 << 0; /** Operating system is Windows 95. */ public static final int OS_WIN95 = OS_WINNT << 1; /** Operating system is Windows 98. */ public static final int OS_WIN98 = OS_WIN95 << 1; /** Operating system is Solaris. */ public static final int OS_SOLARIS = OS_WIN98 << 1; /** Operating system is Linux. */ public static final int OS_LINUX = OS_SOLARIS << 1; /** Operating system is HP-UX. */ public static final int OS_HP = OS_LINUX << 1; /** Operating system is IBM AIX. */ public static final int OS_AIX = OS_HP << 1; /** Operating system is SGI IRIX. */ public static final int OS_IRIX = OS_AIX << 1; /** Operating system is Sun OS. */ public static final int OS_SUNOS = OS_IRIX << 1; /** Operating system is Compaq TRU64 Unix */ public static final int OS_TRU64 = OS_SUNOS << 1; /** Operating system is OS/2. */ public static final int OS_OS2 = OS_TRU64 << 2; /** Operating system is Mac. */ public static final int OS_MAC = OS_OS2 << 1; /** Operating system is Windows 2000. */ public static final int OS_WIN2000 = OS_MAC << 1; /** Operating system is Compaq OpenVMS */ public static final int OS_VMS = OS_WIN2000 << 1; /** *Operating system is one of the Windows variants but we don't know which *one it is */ public static final int OS_WIN_OTHER = OS_VMS << 1; /** Operating system is unknown. */ public static final int OS_OTHER = OS_WIN_OTHER << 1; /** Operating system is FreeBSD * @since 4.50 */ public static final int OS_FREEBSD = OS_OTHER << 1; /** A mask for Windows platforms. */ public static final int OS_WINDOWS_MASK = OS_WINNT | OS_WIN95 | OS_WIN98 | OS_WIN2000 | OS_WIN_OTHER; /** A mask for Unix platforms. */ public static final int OS_UNIX_MASK = OS_SOLARIS | OS_LINUX | OS_HP | OS_AIX | OS_IRIX | OS_SUNOS | OS_TRU64 | OS_MAC | OS_FREEBSD; /** A height of the windows's taskbar */ public static final int TYPICAL_WINDOWS_TASKBAR_HEIGHT = 27; /** A height of the Mac OS X's menu */ private static final int TYPICAL_MACOSX_MENU_HEIGHT = 24;
private static int operatingSystem = -1;
/** reference to map that maps allowed key names to their values (String, Integer) and reference to map for mapping of values to their names */ private static Reference