java::awt::MenuShortcut Class Reference

Inheritance diagram for java::awt::MenuShortcut:

Inheritance graph
java::lang::Object
[legend]
Collaboration diagram for java::awt::MenuShortcut:

Collaboration graph
java::lang::Object
[legend]

List of all members.


Detailed Description

The MenuShortcutclass represents a keyboard accelerator for a MenuItem.

Menu shortcuts are created using virtual keycodes, not characters. For example, a menu shortcut for Ctrl-a would be created with code like the following:

MenuShortcut ms = new MenuShortcut(KeyEvent.VK_A, false);

Author:
Thomas Ball
Version:
1.23, 01/23/03
Since:
JDK1.1

Public Member Functions

 MenuShortcut (jint key=0, jboolean useShiftModifier=false)
 Constructs a new MenuShortcut for the specified virtual keycode.
virtual jint getKey () const
 Returns the raw keycode of this MenuShortcut.
virtual jboolean usesShiftModifier () const
 Returns whether this MenuShortcut must be invoked using the SHIFT key.
virtual jboolean equals (const Object &obj) const
 Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.
virtual jboolean equals (const MenuShortcut &s) const
 Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.
virtual jint hashCode () const
 Returns the hashcode for this MenuShortcut.
virtual String toString () const
 Returns an internationalized description of the MenuShortcut.

Protected Attributes

jint key
 The virtual keycode for the menu shortcut.
jboolean usesShift
 Indicates whether the shft key was pressed.

Constructor & Destructor Documentation

java::awt::MenuShortcut::MenuShortcut ( jint  key = 0,
jboolean  useShiftModifier = false 
)

Constructs a new MenuShortcut for the specified virtual keycode.

Parameters:
key the raw keycode for this MenuShortcut, as would be returned in the keyCode field of a KeyEvent if this key were pressed.
useShiftModifier indicates whether this MenuShortcut is invoked with the SHIFT key down.
See also:
java.awt.event.KeyEvent


Member Function Documentation

virtual jint java::awt::MenuShortcut::getKey (  )  const [virtual]

Returns the raw keycode of this MenuShortcut.

Returns:
the raw keycode of this MenuShortcut.
See also:
java.awt.event.KeyEvent
Since:
JDK1.1

virtual jboolean java::awt::MenuShortcut::usesShiftModifier (  )  const [virtual]

Returns whether this MenuShortcut must be invoked using the SHIFT key.

Returns:
true if this MenuShortcut must be invoked using the SHIFT key, false otherwise.
Since:
JDK1.1

virtual jboolean java::awt::MenuShortcut::equals ( const Object obj  )  const [virtual]

Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.

Parameters:
obj the Object to compare with this.
Returns:
true if this MenuShortcut is the same as another, false otherwise.
Since:
1.2

Reimplemented from java::lang::Object.

virtual jboolean java::awt::MenuShortcut::equals ( const MenuShortcut s  )  const [virtual]

Returns whether this MenuShortcut is the same as another: equality is defined to mean that both MenuShortcuts use the same key and both either use or don't use the SHIFT key.

Parameters:
s the MenuShortcut to compare with this.
Returns:
true if this MenuShortcut is the same as another, false otherwise.
Since:
JDK1.1

virtual jint java::awt::MenuShortcut::hashCode (  )  const [virtual]

Returns the hashcode for this MenuShortcut.

Returns:
the hashcode for this MenuShortcut.
Since:
1.2

Reimplemented from java::lang::Object.

virtual String java::awt::MenuShortcut::toString (  )  const [virtual]

Returns an internationalized description of the MenuShortcut.

Returns:
a string representation of this MenuShortcut.
Since:
JDK1.1

Reimplemented from java::lang::Object.


Member Data Documentation

jint java::awt::MenuShortcut::key [protected]

The virtual keycode for the menu shortcut.

This is the keycode with which the menu shortcut will be created. Note that it is a virtual keycode, not a character, e.g. KeyEvent.VK_A, not 'a'. Note: in 1.1.x you must use setActionCommand() on a menu item in order for its shortcut to work, otherwise it will fire a null action command.

See also:
getKey()

usesShiftModifier()

java.awt.event.KeyEvent

Since:
JDK1.1

jboolean java::awt::MenuShortcut::usesShift [protected]

Indicates whether the shft key was pressed.

If true, the shift key was pressed. If false, the shift key was not pressed

See also:
usesShiftModifier()
Since:
JDK1.1


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:06 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3