devisor2.grid.options
Class Accelerators

java.lang.Object
  extended bydevisor2.grid.options.Accelerators

public class Accelerators
extends java.lang.Object

This class maps the GUI representation of accelerator keys to the Java object representation.
So, nothing spectacular here, just a long, boring multi-if-else-statement.
The application-wide accelerator settings are managed and saved in the Options class. See there for details.

See Also:
devisor2.options.Options

Constructor Summary
Accelerators()
           
 
Method Summary
static javax.swing.KeyStroke getAccelerator(java.lang.String accString)
          Returns the Swing representation of the given (internal) string representing of an accelerator.
static javax.swing.KeyStroke getAccelerator(java.lang.String modifier, java.lang.String key)
          Returns the Swing representation of the accelerator defined by modifier + key
static int getKeyConstant(java.lang.String key)
          returns the KEY_VK constant assigned to the given key
static java.lang.String getKeyString(int key)
          Returns a String representation of the given mmemonic specified by the KeyEvent constant
static boolean isCorrectAccelerator(java.lang.String modifier, java.lang.String key)
          This method "just" checks if the given combination of modifier and key is a correct accelerator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Accelerators

public Accelerators()
Method Detail

getAccelerator

public static javax.swing.KeyStroke getAccelerator(java.lang.String modifier,
                                                   java.lang.String key)
Returns the Swing representation of the accelerator defined by modifier + key

Parameters:
modifier - - one of the constants CRTL, ALT, SHIFT
key - - one of the constants A-Z, 0-9, F-keys or INS, DEL etc.
Returns:
a KeyStroke representation of the combination modifiers + key
See Also:
KeyStroke

getAccelerator

public static javax.swing.KeyStroke getAccelerator(java.lang.String accString)
Returns the Swing representation of the given (internal) string representing of an accelerator. The input format is as follows: "modifier+key".

Returns:
a Keystroke object representing the accelerator

getKeyString

public static java.lang.String getKeyString(int key)
Returns a String representation of the given mmemonic specified by the KeyEvent constant

Parameters:
key - - a KeyEvent constant

getKeyConstant

public static int getKeyConstant(java.lang.String key)
returns the KEY_VK constant assigned to the given key

Parameters:
key - - an A-Z, 0-9, alphanumerical character
See Also:
javax.swing.KeyEvent

isCorrectAccelerator

public static boolean isCorrectAccelerator(java.lang.String modifier,
                                           java.lang.String key)
This method "just" checks if the given combination of modifier and key is a correct accelerator. Accepted combinations are: - if the modifier is NONE, only function keys and INS,DEL,HOME,END PGUP and PGDN are accepted - if the modifier is ALT, no letters are accepted (because these are reserved for the menu)

Parameters:
modifier - - the strings CTRL, ALT, SHIFT, NONE
key - - a String representation of a key (see above)