mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 18:14:38 +02:00
8183518: Premature deprecation of Event/InputEvent/KeyEvent in Java 9
Reviewed-by: prr, psadhukhan
This commit is contained in:
parent
6a21c771ec
commit
d8efdbc4a2
10 changed files with 99 additions and 46 deletions
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package java.awt;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +52,7 @@ import java.awt.event.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
|
||||
|
@ -180,16 +181,15 @@ public class MenuShortcut implements java.io.Serializable
|
|||
* @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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue