< prev index next >
src/java.desktop/share/classes/java/awt/MenuShortcut.java
Print this page
@@ -22,10 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.awt;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
/**
* The {@code MenuShortcut} class represents a keyboard accelerator
* for a MenuItem.
@@ -49,11 +50,11 @@
* work regardless of the current keyboard layout. However, a shortcut made of
* an extended keycode not listed in {@code KeyEvent}
* only work if the current keyboard layout produces a corresponding letter.
* <p>
* The accelerator key is platform-dependent and may be obtained
- * via {@link Toolkit#getMenuShortcutKeyMask}.
+ * via {@link Toolkit#getMenuShortcutKeyMaskEx()}.
*
* @author Thomas Ball
* @since 1.1
*/
public class MenuShortcut implements java.io.Serializable
@@ -178,20 +179,19 @@
/**
* Returns an internationalized description of the MenuShortcut.
* @return a string representation of this MenuShortcut.
* @since 1.1
*/
- @SuppressWarnings("deprecation")
public String toString() {
int modifiers = 0;
if (!GraphicsEnvironment.isHeadless()) {
- modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
+ modifiers = Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
}
if (usesShiftModifier()) {
- modifiers |= Event.SHIFT_MASK;
+ modifiers |= InputEvent.SHIFT_DOWN_MASK;
}
- return KeyEvent.getKeyModifiersText(modifiers) + "+" +
+ return InputEvent.getModifiersExText(modifiers) + "+" +
KeyEvent.getKeyText(key);
}
/**
* Returns the parameter string representing the state of this
< prev index next >