Extension SDK 10.1.2

oracle.ide.keyboard
Class KeyUtil

java.lang.Object
  extended byoracle.ide.keyboard.KeyUtil

public final class KeyUtil
extends java.lang.Object

Some generic methods related to KeyEvents and KeyStrokes.


Constructor Summary
KeyUtil()
           
 
Method Summary
static java.lang.String buildTooltip(int cmdID)
          Builds a tooltip for a command in the form of cmd-name[ " (" accelerator ")" ]
static java.lang.String getAcceleratorTooltip(int cmdID)
           
static java.lang.String getAcceleratorTooltip(KeyStrokeMap keyMap, int cmdID)
           
static javax.swing.KeyStroke getBestAccelerator(KeyStrokeMap ksm, int nCmdID)
          Return the 'best' accelerator found in the map for the specified command ID.
static boolean isActionKey(javax.swing.KeyStroke ks)
          Only the KeyEvent knows what is an action key, the KeyStroke does not.
static boolean isModifierKey(int keyCode)
          Determines if the key is a modifier (Ctrl, Shift, ...)
static boolean isModifierKey(javax.swing.KeyStroke keyStroke)
          Determines if the key is a modifier (Ctrl, Shift, ...)
static void removeCtrlTabFromTraversalKeys(java.awt.Component component)
          Removes the Ctrl+Tab and Ctrl+Shift+Tab from the focusTraversalKeys
static void removeKeyStrokesFromInputMap(javax.swing.JComponent component, javax.swing.KeyStroke[] keyStrokes, int mapType)
           
static void removeKeyStrokesFromInputMaps(javax.swing.JComponent component, javax.swing.KeyStroke[] keyStrokes)
           
static java.lang.String toString(javax.swing.KeyStroke ks)
          Returns a user readable version of the keystroke like "Ctrl+K".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyUtil

public KeyUtil()
Method Detail

toString

public static java.lang.String toString(javax.swing.KeyStroke ks)
Returns a user readable version of the keystroke like "Ctrl+K".

Parameters:
ks - the keystroke
Returns:
the text

isActionKey

public static boolean isActionKey(javax.swing.KeyStroke ks)
Only the KeyEvent knows what is an action key, the KeyStroke does not.


isModifierKey

public static boolean isModifierKey(int keyCode)
Determines if the key is a modifier (Ctrl, Shift, ...)


isModifierKey

public static boolean isModifierKey(javax.swing.KeyStroke keyStroke)
Determines if the key is a modifier (Ctrl, Shift, ...)


removeKeyStrokesFromInputMaps

public static void removeKeyStrokesFromInputMaps(javax.swing.JComponent component,
                                                 javax.swing.KeyStroke[] keyStrokes)
See Also:
{@link SwingUtils#removeKeyStrokesFromInputMaps(JComponent,KeyStroke[])}

removeKeyStrokesFromInputMap

public static void removeKeyStrokesFromInputMap(javax.swing.JComponent component,
                                                javax.swing.KeyStroke[] keyStrokes,
                                                int mapType)
See Also:
{@link SwingUtils#removeKeyStrokesFromInputMap(JComponent,KeyStroke[],int)}

getAcceleratorTooltip

public static java.lang.String getAcceleratorTooltip(int cmdID)
Parameters:
cmdID - the ID of a command present in the global keymap
Returns:
the accelerator string of the specified command

getAcceleratorTooltip

public static java.lang.String getAcceleratorTooltip(KeyStrokeMap keyMap,
                                                     int cmdID)

buildTooltip

public static java.lang.String buildTooltip(int cmdID)
Builds a tooltip for a command in the form of cmd-name[ " (" accelerator ")" ]

Parameters:
cmdID -
Returns:
the tooltip

removeCtrlTabFromTraversalKeys

public static void removeCtrlTabFromTraversalKeys(java.awt.Component component)
Removes the Ctrl+Tab and Ctrl+Shift+Tab from the focusTraversalKeys

Parameters:
component -

getBestAccelerator

public static javax.swing.KeyStroke getBestAccelerator(KeyStrokeMap ksm,
                                                       int nCmdID)
Return the 'best' accelerator found in the map for the specified command ID. The 'best' is defined as an accelerator with a maximum of 1 keystroke (not a sequence) F-keys are preferred to letters which are preferred to others (Ins,Del, Home, ...)

Parameters:
ksm -
nCmdID -
Returns:
the best keystroke found in this map.

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.