start page | rating of books | rating of authors | reviews | copyrights

Java AWT

Previous Chapter 19
java.awt Reference
Next
 

MenuShortcut (New)

Name

MenuShortcut (New)

[Graphic: Figure from the text]

Description

A MenuShortcut is used to associate a keystroke with a menu item. MenuShortcuts are constructed using their corresponding key; they are associated with menu items via MenuItem.setShortcut(MenuShortcut).

Class Definition

public class java.awt.MenuShortcut
    extends java.awt.Event {
  // Constructors
  public MenuShortcut (int key);
  public MenuShortcut (int key, boolean useShiftModifier);
  // Instance Methods
  public boolean equals (MenuShortcut s);
  public int getKey();
  public String toString();
  public boolean usesShiftModifier();
  // Protected Instance Methods
  protected String paramString();
}

Constructors

MenuShortcut

public MenuShortcut (int key)

Parameters

key

A keycode like those returned with key press Event objects.

Description

Constructs a MenuShortcut object for the given key.

public MenuShortcut (int key, boolean useShiftModifier)

Parameters

key

A keycode like those returned with key press Event objects.

useShiftModifier

true if the Shift key must be used, false otherwise.

Description

Constructs a MenuShortcut object with the given values.

Instance Methods

equals

public boolean equals (MenuShortcut s)

Parameters

s

The MenuShortcut to compare.

Returns

true if s is equal to this MenuShortcut, false otherwise.

getKey

public int getKey()

Returns

The key for this MenuShortcut.

toString

public String toString()

Returns

A string representation of the MenuShortcut object.

Overrides

Event.toString()

usesShiftModifier

public boolean usesShiftModifier()

Returns

true if this MenuShortcut must be invoked with the Shift key pressed, false otherwise.

Protected Instance Methods

paramString

protected String paramString()

Returns

String with current settings of MenuShortcut.

Overrides

Event.paramString()

Description

Helper method for toString() to generate string of current settings.

See Also

Event, MenuItem


Previous Home Next
MenuItem Book Index Panel

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java