|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbuoy.widget.Shortcut
public class Shortcut
A Shortcut represents a keyboard shortcut that can be used for activating a menu item. It consists of a particular key that must be pressed, plus a set of modifier keys.
Every platform has a "standard" modifier key which is normally used for activating menu items. That modifier is represented by the DEFAULT_MASK constant. In most cases, you can simply use a constructor which does not specify modifier keys, in which case the platform-specific default modifier will be used. If you want to add other modifier keys, you should generally combine them with the default mask. For example:
new Shortcut('X', Shortcut.SHIFT_MASK | Shortcut.DEFAULT_MASK)
will correspond to control-shift-X on Windows, and meta-shift-X on Macintosh.
Field Summary | |
---|---|
static int |
ALT_MASK
|
static int |
CTRL_MASK
|
static int |
DEFAULT_MASK
|
static int |
META_MASK
|
static int |
SHIFT_MASK
|
Constructor Summary | |
---|---|
Shortcut(char c)
Create a Shortcut representing a particular character, combined with the platform-specific default modifier key. |
|
Shortcut(char c,
int modifiers)
Create a Shortcut representing a particular character, combined with a set of modifier keys. |
|
Shortcut(int key)
Create a Shortcut representing a particular key, combined with the platform-specific default modifier key. |
|
Shortcut(int key,
int modifiers)
Create a Shortcut representing a particular key, combined with a set of modifier keys. |
Method Summary | |
---|---|
char |
getKeyChar()
Get the character which must be typed to activate this shortcut. |
int |
getKeyCode()
Get the key code (defined by the KeyEvent class) which must be typed to activate this shortcut. |
javax.swing.KeyStroke |
getKeyStroke()
Get a KeyStroke corresponding to this Shortcut. |
int |
getModifiers()
Get the set of modifier keys (a sum of the mask constants defined by this class) which must be held down to activate this shortcut. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SHIFT_MASK
public static final int CTRL_MASK
public static final int META_MASK
public static final int ALT_MASK
public static final int DEFAULT_MASK
Constructor Detail |
---|
public Shortcut(char c)
c
- the character which must be typed to activate the shortcutpublic Shortcut(int key)
key
- the key code (defined by the KeyEvent class) which must be typed to activate the shortcutpublic Shortcut(char c, int modifiers)
c
- the character which must be typed to activate the shortcutmodifiers
- the set of modifier keys required to activate the shortcut. This should be an ORed
combination of the mask constants defined in this classpublic Shortcut(int key, int modifiers)
key
- the key code (defined by the KeyEvent class) which must be typed to activate the shortcutmodifiers
- the set of modifier keys required to activate the shortcut. This should be an ORed
combination of the mask constants defined in this classMethod Detail |
---|
public javax.swing.KeyStroke getKeyStroke()
public char getKeyChar()
public int getKeyCode()
public int getModifiers()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |