8143077: Deprecate InputEvent._MASK in favor of InputEvent._DOWN_MASK

Reviewed-by: prr, alexsch, azvegint, mchung, egahlin
This commit is contained in:
Sergey Bylokhov 2017-01-31 19:22:35 +03:00
parent f6c6c8edd0
commit ef7192a7b8
98 changed files with 233 additions and 58 deletions

View file

@ -154,9 +154,15 @@ class AquaComboBoxPopup extends BasicComboPopup {
protected JList<Object> createList() { protected JList<Object> createList() {
return new JList<Object>(comboBox.getModel()) { return new JList<Object>(comboBox.getModel()) {
@Override @Override
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e) { public void processMouseEvent(MouseEvent e) {
if (e.isMetaDown()) { if (e.isMetaDown()) {
e = new MouseEvent((Component)e.getSource(), e.getID(), e.getWhen(), e.getModifiers() ^ InputEvent.META_MASK, e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON); e = new MouseEvent((Component) e.getSource(), e.getID(),
e.getWhen(),
e.getModifiers() ^ InputEvent.META_MASK,
e.getX(), e.getY(), e.getXOnScreen(),
e.getYOnScreen(), e.getClickCount(),
e.isPopupTrigger(), MouseEvent.NOBUTTON);
} }
super.processMouseEvent(e); super.processMouseEvent(e);
} }

View file

@ -137,6 +137,7 @@ public final class AquaInternalFrameDockIconUI extends DesktopIconUI
} }
@Override @Override
@SuppressWarnings("deprecation")
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return; if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
String title = fFrame.getTitle(); String title = fFrame.getTitle();
@ -146,6 +147,7 @@ public final class AquaInternalFrameDockIconUI extends DesktopIconUI
} }
@Override @Override
@SuppressWarnings("deprecation")
public void mouseExited(final MouseEvent e) { public void mouseExited(final MouseEvent e) {
if (fDockLabel != null && (e.getModifiers() & InputEvent.BUTTON1_MASK) == 0) fDockLabel.hide(); if (fDockLabel != null && (e.getModifiers() & InputEvent.BUTTON1_MASK) == 0) fDockLabel.hide();
} }

View file

@ -555,6 +555,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
} }
@Override @Override
@SuppressWarnings("deprecation")
public void mouseDragged(final MouseEvent e) { public void mouseDragged(final MouseEvent e) {
// do not forward drags // do not forward drags
// if (didForwardEvent(e)) return; // if (didForwardEvent(e)) return;
@ -621,7 +622,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
return didForwardEvent; return didForwardEvent;
} }
@SuppressWarnings("deprecation")
boolean didForwardEventInternal(final MouseEvent e) { boolean didForwardEventInternal(final MouseEvent e) {
if (fDraggingFrame) return false; if (fDraggingFrame) return false;
@ -927,11 +928,15 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
return (w - x) + (h - y) < 12; return (w - x) + (h - y) < 12;
} }
@SuppressWarnings("deprecation")
void forwardEventToFrame(final MouseEvent e) { void forwardEventToFrame(final MouseEvent e) {
final Point pt = new Point(); final Point pt = new Point();
final Component c = getComponentToForwardTo(e, pt); final Component c = getComponentToForwardTo(e, pt);
if (c == null) return; if (c == null) return;
c.dispatchEvent(new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiers(), pt.x, pt.y, e.getClickCount(), e.isPopupTrigger(), e.getButton())); c.dispatchEvent(
new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiers(),
pt.x, pt.y, e.getClickCount(),
e.isPopupTrigger(), e.getButton()));
} }
Component getComponentToForwardTo(final MouseEvent e, final Point dst) { Component getComponentToForwardTo(final MouseEvent e, final Point dst) {
@ -993,6 +998,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
public void mouseMoved(final MouseEvent e) { } public void mouseMoved(final MouseEvent e) { }
@Override @Override
@SuppressWarnings("deprecation")
public void mouseWheelMoved(final MouseWheelEvent e) { public void mouseWheelMoved(final MouseWheelEvent e) {
final Point pt = new Point(); final Point pt = new Point();
final Component c = getComponentToForwardTo(e, pt); final Component c = getComponentToForwardTo(e, pt);

View file

@ -74,7 +74,10 @@ public class AquaMenuPainter {
kUCapsLockGlyph = 0x21EA; kUCapsLockGlyph = 0x21EA;
static final int ALT_GRAPH_MASK = 1 << 5; // New to Java2 static final int ALT_GRAPH_MASK = 1 << 5; // New to Java2
static final int sUnsupportedModifiersMask = ~(InputEvent.CTRL_MASK | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK | InputEvent.META_MASK | ALT_GRAPH_MASK); @SuppressWarnings("deprecation")
static final int sUnsupportedModifiersMask =
~(InputEvent.CTRL_MASK | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK
| InputEvent.META_MASK | ALT_GRAPH_MASK);
interface Client { interface Client {
public void paintBackground(Graphics g, JComponent c, int menuWidth, int menuHeight); public void paintBackground(Graphics g, JComponent c, int menuWidth, int menuHeight);
@ -86,6 +89,7 @@ public class AquaMenuPainter {
} }
// Return a string with the proper modifier glyphs // Return a string with the proper modifier glyphs
@SuppressWarnings("deprecation")
private static String getKeyModifiersUnicode(final int modifiers, final boolean isLeftToRight) { private static String getKeyModifiersUnicode(final int modifiers, final boolean isLeftToRight) {
final StringBuilder buf = new StringBuilder(2); final StringBuilder buf = new StringBuilder(2);
// Order (from StandardMenuDef.c): control, option(alt), shift, cmd // Order (from StandardMenuDef.c): control, option(alt), shift, cmd

View file

@ -515,6 +515,7 @@ public class AquaTabbedPaneCopyFromBasicUI extends TabbedPaneUI implements Swing
/** /**
* Adds the specified mnemonic at the specified index. * Adds the specified mnemonic at the specified index.
*/ */
@SuppressWarnings("deprecation")
private void addMnemonic(final int index, final int mnemonic) { private void addMnemonic(final int index, final int mnemonic) {
if (mnemonicToIndexMap == null) { if (mnemonicToIndexMap == null) {
initMnemonics(); initMnemonics();

View file

@ -1224,6 +1224,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
* Changes the target of the AWTEvent from awt component to appropriate * Changes the target of the AWTEvent from awt component to appropriate
* swing delegate. * swing delegate.
*/ */
@SuppressWarnings("deprecation")
private AWTEvent createDelegateEvent(final AWTEvent e) { private AWTEvent createDelegateEvent(final AWTEvent e) {
// TODO modifiers should be changed to getModifiers()|getModifiersEx()? // TODO modifiers should be changed to getModifiers()|getModifiersEx()?
AWTEvent delegateEvent = null; AWTEvent delegateEvent = null;

View file

@ -302,6 +302,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
} }
@Override @Override
@SuppressWarnings("deprecation")
protected void processMouseEvent(final MouseEvent e) { protected void processMouseEvent(final MouseEvent e) {
super.processMouseEvent(e); super.processMouseEvent(e);
if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() == 2) { if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() == 2) {
@ -314,6 +315,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
} }
@Override @Override
@SuppressWarnings("deprecation")
protected void processKeyEvent(final KeyEvent e) { protected void processKeyEvent(final KeyEvent e) {
super.processKeyEvent(e); super.processKeyEvent(e);
if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ENTER) { if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_ENTER) {

View file

@ -93,6 +93,7 @@ public final class CDragSourceContextPeer extends SunDragSourceContextPeer {
InputEvent triggerEvent = trigger.getTriggerEvent(); InputEvent triggerEvent = trigger.getTriggerEvent();
Point dragOrigin = new Point(trigger.getDragOrigin()); Point dragOrigin = new Point(trigger.getDragOrigin());
@SuppressWarnings("deprecation")
int extModifiers = (triggerEvent.getModifiers() | triggerEvent.getModifiersEx()); int extModifiers = (triggerEvent.getModifiers() | triggerEvent.getModifiersEx());
long timestamp = triggerEvent.getWhen(); long timestamp = triggerEvent.getWhen();
int clickCount = ((triggerEvent instanceof MouseEvent) ? (((MouseEvent) triggerEvent).getClickCount()) : 1); int clickCount = ((triggerEvent instanceof MouseEvent) ? (((MouseEvent) triggerEvent).getClickCount()) : 1);

View file

@ -63,7 +63,7 @@ public class CMenuItem extends CMenuComponent implements MenuItemPeer {
CMenuComponent parent = (CMenuComponent)LWToolkit.targetToPeer(getTarget().getParent()); CMenuComponent parent = (CMenuComponent)LWToolkit.targetToPeer(getTarget().getParent());
return parent.executeGet(ptr->nativeCreate(ptr, isSeparator())); return parent.executeGet(ptr->nativeCreate(ptr, isSeparator()));
} }
@SuppressWarnings("deprecation")
public void setLabel(String label, char keyChar, int keyCode, int modifiers) { public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
int keyMask = modifiers; int keyMask = modifiers;
if (keyCode == KeyEvent.VK_UNDEFINED) { if (keyCode == KeyEvent.VK_UNDEFINED) {

View file

@ -46,6 +46,7 @@ final class CPopupMenu extends CMenu implements PopupMenuPeer {
private native long nativeShowPopupMenu(long modelPtr, int x, int y); private native long nativeShowPopupMenu(long modelPtr, int x, int y);
@Override @Override
@SuppressWarnings("deprecation")
public void show(Event e) { public void show(Event e) {
Component origin = (Component)e.target; Component origin = (Component)e.target;
if (origin != null) { if (origin != null) {

View file

@ -68,6 +68,7 @@ public class CPrinterDialogPeer extends LWWindowPeer {
public void setResizable(boolean resizable) {} public void setResizable(boolean resizable) {}
public void setEnabled(boolean enable) {} public void setEnabled(boolean enable) {}
public void setBounds(int x, int y, int width, int height) {} public void setBounds(int x, int y, int width, int height) {}
@SuppressWarnings("deprecation")
public boolean handleEvent(Event e) { return false; } public boolean handleEvent(Event e) { return false; }
public void setForeground(Color c) {} public void setForeground(Color c) {}
public void setBackground(Color c) {} public void setBackground(Color c) {}

View file

@ -532,6 +532,7 @@ public final class LWCToolkit extends LWToolkit {
* @since 1.1 * @since 1.1
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public int getMenuShortcutKeyMask() { public int getMenuShortcutKeyMask() {
return Event.META_MASK; return Event.META_MASK;
} }
@ -768,6 +769,7 @@ public final class LWCToolkit extends LWToolkit {
* stroke. * stroke.
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() { public int getFocusAcceleratorKeyMask() {
return InputEvent.CTRL_MASK | InputEvent.ALT_MASK; return InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
} }
@ -777,6 +779,7 @@ public final class LWCToolkit extends LWToolkit {
* printable character. * printable character.
*/ */
@Override @Override
@SuppressWarnings("deprecation")
public boolean isPrintableCharacterModifiersMask(int mods) { public boolean isPrintableCharacterModifiersMask(int mods) {
return ((mods & (InputEvent.META_MASK | InputEvent.CTRL_MASK)) == 0); return ((mods & (InputEvent.META_MASK | InputEvent.CTRL_MASK)) == 0);
} }

View file

@ -236,7 +236,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
} }
}); });
} }
@SuppressWarnings("deprecation")
void forwardEventToParent(MouseEvent e) { void forwardEventToParent(MouseEvent e) {
getParent().dispatchEvent(new MouseEvent( getParent().dispatchEvent(new MouseEvent(
getParent(), e.getID(), e.getWhen(), e.getModifiers(), getParent(), e.getID(), e.getWhen(), e.getModifiers(),
@ -329,7 +329,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
} }
}); });
} }
@SuppressWarnings("deprecation")
void forwardEventToParent(MouseEvent e) { void forwardEventToParent(MouseEvent e) {
getParent().dispatchEvent(new MouseEvent( getParent().dispatchEvent(new MouseEvent(
getParent(), e.getID(), e.getWhen(), e.getModifiers(), getParent(), e.getID(), e.getWhen(), e.getModifiers(),

View file

@ -139,10 +139,11 @@ public class MotifGraphicsUtils implements SwingConstants
} }
/** /**
* This method is not being used to paint menu item since * @deprecated This method is not being used to paint menu item since
* 6.0 This code left for compatibility only. Do not use or * 6.0 This code left for compatibility only. Do not use or
* override it, this will not cause any visible effect. * override it, this will not cause any visible effect.
*/ */
@Deprecated(since = "9")
public static void paintMenuItem(Graphics g, JComponent c, public static void paintMenuItem(Graphics g, JComponent c,
Icon checkIcon, Icon arrowIcon, Icon checkIcon, Icon arrowIcon,
Color background, Color foreground, Color background, Color foreground,

View file

@ -361,7 +361,7 @@ public class MotifInternalFrameTitlePane
} }
}); });
} }
@SuppressWarnings("deprecation")
void forwardEventToParent(MouseEvent e) { void forwardEventToParent(MouseEvent e) {
getParent().dispatchEvent(new MouseEvent( getParent().dispatchEvent(new MouseEvent(
getParent(), e.getID(), e.getWhen(), e.getModifiers(), getParent(), e.getID(), e.getWhen(), e.getModifiers(),

View file

@ -523,7 +523,8 @@ public class MotifLookAndFeel extends BasicLookAndFeel
Object optionPaneMessageAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,12,10); Object optionPaneMessageAreaBorder = new BorderUIResource.EmptyBorderUIResource(10,10,12,10);
@SuppressWarnings("deprecation")
final int metaMask = KeyEvent.META_MASK;
Object[] defaults = { Object[] defaults = {
"Desktop.background", table.get("desktop"), "Desktop.background", table.get("desktop"),
@ -635,8 +636,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
"Menu.submenuPopupOffsetX", -2, "Menu.submenuPopupOffsetX", -2,
"Menu.submenuPopupOffsetY", 3, "Menu.submenuPopupOffsetY", 3,
"Menu.shortcutKeys", new int[]{ "Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask(), SwingUtilities2.getSystemMnemonicKeyMask(), metaMask
KeyEvent.META_MASK
}, },
"Menu.cancelMode", "hideMenuTree", "Menu.cancelMode", "hideMenuTree",

View file

@ -107,6 +107,7 @@ public class MotifPopupMenuUI extends BasicPopupMenuUI {
}; };
} }
@SuppressWarnings("deprecation")
public boolean isPopupTrigger(MouseEvent e) { public boolean isPopupTrigger(MouseEvent e) {
return ((e.getID()==MouseEvent.MOUSE_PRESSED) return ((e.getID()==MouseEvent.MOUSE_PRESSED)
&& ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0)); && ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0));

View file

@ -155,6 +155,7 @@ public class MotifTextUI {
/** /**
* Default bindings all keymaps implementing the Motif feel. * Default bindings all keymaps implementing the Motif feel.
*/ */
@SuppressWarnings("deprecation")
static final JTextComponent.KeyBinding[] defaultBindings = { static final JTextComponent.KeyBinding[] defaultBindings = {
new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT,
InputEvent.CTRL_MASK), InputEvent.CTRL_MASK),

View file

@ -63,6 +63,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
private boolean contentOpaque = true; private boolean contentOpaque = true;
@SuppressWarnings("deprecation")
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
contentOpaque = UIManager.getBoolean("TabbedPane.contentOpaque"); contentOpaque = UIManager.getBoolean("TabbedPane.contentOpaque");

View file

@ -292,8 +292,12 @@ public abstract class AWTEvent extends EventObject {
/** /**
* Constructs an AWTEvent object from the parameters of a 1.0-style event. * Constructs an AWTEvent object from the parameters of a 1.0-style event.
*
* @param event the old-style event * @param event the old-style event
* @deprecated It is recommended that {@link #AWTEvent(Object, int)} be used
* instead
*/ */
@Deprecated(since = "9")
public AWTEvent(Event event) { public AWTEvent(Event event) {
this(event.target, event.id); this(event.target, event.id);
} }
@ -436,6 +440,7 @@ public abstract class AWTEvent extends EventObject {
* event class in java.awt.event because we don't want to make * event class in java.awt.event because we don't want to make
* it public and it needs to be called from java.awt. * it public and it needs to be called from java.awt.
*/ */
@SuppressWarnings("deprecation")
Event convertToOld() { Event convertToOld() {
Object src = getSource(); Object src = getSource();
int newid = id; int newid = id;

View file

@ -350,6 +350,7 @@ public class AWTKeyStroke implements Serializable {
* @throws NullPointerException if {@code anEvent} is null * @throws NullPointerException if {@code anEvent} is null
* @return the {@code AWTKeyStroke} that precipitated the event * @return the {@code AWTKeyStroke} that precipitated the event
*/ */
@SuppressWarnings("deprecation")
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) { public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) {
int id = anEvent.getID(); int id = anEvent.getID();
switch(id) { switch(id) {
@ -397,6 +398,7 @@ public class AWTKeyStroke implements Serializable {
* @throws IllegalArgumentException if {@code s} is {@code null}, * @throws IllegalArgumentException if {@code s} is {@code null},
* or is formatted incorrectly * or is formatted incorrectly
*/ */
@SuppressWarnings("deprecation")
public static AWTKeyStroke getAWTKeyStroke(String s) { public static AWTKeyStroke getAWTKeyStroke(String s) {
if (s == null) { if (s == null) {
throw new IllegalArgumentException("String cannot be null"); throw new IllegalArgumentException("String cannot be null");
@ -708,6 +710,7 @@ public class AWTKeyStroke implements Serializable {
} }
} }
@SuppressWarnings("deprecation")
private static int mapOldModifiers(int modifiers) { private static int mapOldModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) { if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
modifiers |= InputEvent.SHIFT_DOWN_MASK; modifiers |= InputEvent.SHIFT_DOWN_MASK;
@ -737,6 +740,7 @@ public class AWTKeyStroke implements Serializable {
return modifiers; return modifiers;
} }
@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) { private static int mapNewModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
modifiers |= InputEvent.SHIFT_MASK; modifiers |= InputEvent.SHIFT_MASK;

View file

@ -5036,6 +5036,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* *
* Returns whether or not event was dispatched to an ancestor * Returns whether or not event was dispatched to an ancestor
*/ */
@SuppressWarnings("deprecation")
boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) { boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
int newX, newY; int newX, newY;
newX = e.getX() + getX(); // Coordinates take into account at least newX = e.getX() + getX(); // Coordinates take into account at least

View file

@ -4728,6 +4728,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
* Listen for drag events posted in other hw components so we can * Listen for drag events posted in other hw components so we can
* track enter/exit regardless of where a drag originated * track enter/exit regardless of where a drag originated
*/ */
@SuppressWarnings("deprecation")
public void eventDispatched(AWTEvent e) { public void eventDispatched(AWTEvent e) {
boolean isForeignDrag = (e instanceof MouseEvent) && boolean isForeignDrag = (e instanceof MouseEvent) &&
!(e instanceof SunDropTargetEvent) && !(e instanceof SunDropTargetEvent) &&
@ -4826,6 +4827,7 @@ class LightweightDispatcher implements java.io.Serializable, AWTEventListener {
* If the target has been removed, we don't bother to send the * If the target has been removed, we don't bother to send the
* message. * message.
*/ */
@SuppressWarnings("deprecation")
void retargetMouseEvent(Component target, int id, MouseEvent e) { void retargetMouseEvent(Component target, int id, MouseEvent e) {
if (target == null) { if (target == null) {
return; // mouse is over another hw component or target is disabled return; // mouse is over another hw component or target is disabled

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,7 @@
*/ */
package java.awt; package java.awt;
import java.awt.event.*; import java.awt.event.KeyEvent;
import java.io.*;
/** /**
* <b>NOTE:</b> The {@code Event} class is obsolete and is * <b>NOTE:</b> The {@code Event} class is obsolete and is
@ -56,9 +55,12 @@ import java.io.*;
* {@code Event} class ({@code PGUP}, * {@code Event} class ({@code PGUP},
* {@code PGDN}, {@code F1}, {@code F2}, etc). * {@code PGDN}, {@code F1}, {@code F2}, etc).
* *
* @deprecated It is recommended that {@code AWTEvent} and its subclasses be
* used instead
* @author Sami Shaio * @author Sami Shaio
* @since 1.0 * @since 1.0
*/ */
@Deprecated(since = "9")
public class Event implements java.io.Serializable { public class Event implements java.io.Serializable {
private transient long data; private transient long data;

View file

@ -415,6 +415,7 @@ public abstract class KeyboardFocusManager
* Initializes a KeyboardFocusManager. * Initializes a KeyboardFocusManager.
*/ */
public KeyboardFocusManager() { public KeyboardFocusManager() {
@SuppressWarnings("deprecation")
AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = { AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
{ {
AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false), AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),

View file

@ -375,6 +375,7 @@ public class MenuBar extends MenuComponent implements MenuContainer, Accessible
* keydown). Returns true if there is an associated * keydown). Returns true if there is an associated
* keyboard event. * keyboard event.
*/ */
@SuppressWarnings("deprecation")
boolean handleShortcut(KeyEvent e) { boolean handleShortcut(KeyEvent e) {
// Is it a key event? // Is it a key event?
int id = e.getID(); int id = e.getID();

View file

@ -379,6 +379,7 @@ public abstract class MenuComponent implements java.io.Serializable {
} }
} else { // backward compatibility } else { // backward compatibility
@SuppressWarnings("deprecation")
Event olde = e.convertToOld(); Event olde = e.convertToOld();
if (olde != null) { if (olde != null) {
postEvent(olde); postEvent(olde);

View file

@ -435,6 +435,7 @@ public class MenuItem extends MenuComponent implements Accessible {
* keydown) and the item is enabled. * keydown) and the item is enabled.
* Returns true if there is an associated shortcut. * Returns true if there is an associated shortcut.
*/ */
@SuppressWarnings("deprecation")
boolean handleShortcut(KeyEvent e) { boolean handleShortcut(KeyEvent e) {
MenuShortcut s = new MenuShortcut(e.getKeyCode(), MenuShortcut s = new MenuShortcut(e.getKeyCode(),
(e.getModifiers() & InputEvent.SHIFT_MASK) > 0); (e.getModifiers() & InputEvent.SHIFT_MASK) > 0);

View file

@ -180,6 +180,7 @@ public class MenuShortcut implements java.io.Serializable
* @return a string representation of this MenuShortcut. * @return a string representation of this MenuShortcut.
* @since 1.1 * @since 1.1
*/ */
@SuppressWarnings("deprecation")
public String toString() { public String toString() {
int modifiers = 0; int modifiers = 0;
if (!GraphicsEnvironment.isHeadless()) { if (!GraphicsEnvironment.isHeadless()) {

View file

@ -154,6 +154,7 @@ public class PopupMenu extends Menu {
* parent's hierarchy * parent's hierarchy
* @exception RuntimeException if the parent is not showing on screen * @exception RuntimeException if the parent is not showing on screen
*/ */
@SuppressWarnings("deprecation")
public void show(Component origin, int x, int y) { public void show(Component origin, int x, int y) {
// Use localParent for thread safety. // Use localParent for thread safety.
MenuContainer localParent = parent; MenuContainer localParent = parent;

View file

@ -137,6 +137,7 @@ public class Robot {
initLegalButtonMask(); initLegalButtonMask();
} }
@SuppressWarnings("deprecation")
private static synchronized void initLegalButtonMask() { private static synchronized void initLegalButtonMask() {
if (LEGAL_BUTTON_MASK != 0) return; if (LEGAL_BUTTON_MASK != 0) return;

View file

@ -1067,6 +1067,7 @@ public abstract class Toolkit {
* @see java.awt.MenuShortcut * @see java.awt.MenuShortcut
* @since 1.1 * @since 1.1
*/ */
@SuppressWarnings("deprecation")
public int getMenuShortcutKeyMask() throws HeadlessException { public int getMenuShortcutKeyMask() throws HeadlessException {
GraphicsEnvironment.checkHeadless(); GraphicsEnvironment.checkHeadless();

View file

@ -281,6 +281,7 @@ public class DragSourceDragEvent extends DragSourceEvent {
* The mouse modifiers have higher priority than overlaying key * The mouse modifiers have higher priority than overlaying key
* modifiers. * modifiers.
*/ */
@SuppressWarnings("deprecation")
private void setNewModifiers() { private void setNewModifiers() {
if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) { if ((gestureModifiers & InputEvent.BUTTON1_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK; gestureModifiers |= InputEvent.BUTTON1_DOWN_MASK;
@ -305,6 +306,7 @@ public class DragSourceDragEvent extends DragSourceEvent {
/** /**
* Sets old modifiers by the new ones. * Sets old modifiers by the new ones.
*/ */
@SuppressWarnings("deprecation")
private void setOldModifiers() { private void setOldModifiers() {
if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) { if ((gestureModifiers & InputEvent.BUTTON1_DOWN_MASK) != 0) {
gestureModifiers |= InputEvent.BUTTON1_MASK; gestureModifiers |= InputEvent.BUTTON1_MASK;

View file

@ -26,7 +26,6 @@
package java.awt.event; package java.awt.event;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.Event;
import java.lang.annotation.Native; import java.lang.annotation.Native;
/** /**
@ -63,25 +62,25 @@ public class ActionEvent extends AWTEvent {
* The shift modifier. An indicator that the shift key was held * The shift modifier. An indicator that the shift key was held
* down during the event. * down during the event.
*/ */
public static final int SHIFT_MASK = Event.SHIFT_MASK; public static final int SHIFT_MASK = 1 << 0;
/** /**
* The control modifier. An indicator that the control key was held * The control modifier. An indicator that the control key was held
* down during the event. * down during the event.
*/ */
public static final int CTRL_MASK = Event.CTRL_MASK; public static final int CTRL_MASK = 1 << 1;
/** /**
* The meta modifier. An indicator that the meta key was held * The meta modifier. An indicator that the meta key was held
* down during the event. * down during the event.
*/ */
public static final int META_MASK = Event.META_MASK; public static final int META_MASK = 1 << 2;
/** /**
* The alt modifier. An indicator that the alt key was held * The alt modifier. An indicator that the alt key was held
* down during the event. * down during the event.
*/ */
public static final int ALT_MASK = Event.ALT_MASK; public static final int ALT_MASK = 1 << 3;
/** /**
@ -274,6 +273,7 @@ public class ActionEvent extends AWTEvent {
* *
* @return a string identifying the event and its associated command * @return a string identifying the event and its associated command
*/ */
@SuppressWarnings("deprecation")
public String paramString() { public String paramString() {
String typeStr; String typeStr;
switch(id) { switch(id) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -62,51 +62,76 @@ public abstract class InputEvent extends ComponentEvent {
/** /**
* The Shift key modifier constant. * The Shift key modifier constant.
* It is recommended that SHIFT_DOWN_MASK be used instead. *
* @deprecated It is recommended that SHIFT_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int SHIFT_MASK = Event.SHIFT_MASK; public static final int SHIFT_MASK = Event.SHIFT_MASK;
/** /**
* The Control key modifier constant. * The Control key modifier constant.
* It is recommended that CTRL_DOWN_MASK be used instead. *
* @deprecated It is recommended that CTRL_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int CTRL_MASK = Event.CTRL_MASK; public static final int CTRL_MASK = Event.CTRL_MASK;
/** /**
* The Meta key modifier constant. * The Meta key modifier constant.
* It is recommended that META_DOWN_MASK be used instead. *
* @deprecated It is recommended that META_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int META_MASK = Event.META_MASK; public static final int META_MASK = Event.META_MASK;
/** /**
* The Alt key modifier constant. * The Alt key modifier constant.
* It is recommended that ALT_DOWN_MASK be used instead. *
* @deprecated It is recommended that ALT_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int ALT_MASK = Event.ALT_MASK; public static final int ALT_MASK = Event.ALT_MASK;
/** /**
* The AltGraph key modifier constant. * The AltGraph key modifier constant.
*
* @deprecated It is recommended that ALT_GRAPH_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int ALT_GRAPH_MASK = 1 << 5; public static final int ALT_GRAPH_MASK = 1 << 5;
/** /**
* The Mouse Button1 modifier constant. * The Mouse Button1 modifier constant.
* It is recommended that BUTTON1_DOWN_MASK be used instead. *
* @deprecated It is recommended that BUTTON1_DOWN_MASK and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public static final int BUTTON1_MASK = 1 << 4; public static final int BUTTON1_MASK = 1 << 4;
/** /**
* The Mouse Button2 modifier constant. * The Mouse Button2 modifier constant.
* It is recommended that BUTTON2_DOWN_MASK be used instead. *
* Note that BUTTON2_MASK has the same value as ALT_MASK. * @deprecated It is recommended that BUTTON2_DOWN_MASK and
* {@link #getModifiersEx()} be used instead. Note that
* BUTTON2_MASK has the same value as ALT_MASK.
*/ */
@Deprecated(since = "9")
public static final int BUTTON2_MASK = Event.ALT_MASK; public static final int BUTTON2_MASK = Event.ALT_MASK;
/** /**
* The Mouse Button3 modifier constant. * The Mouse Button3 modifier constant.
* It is recommended that BUTTON3_DOWN_MASK be used instead. *
* Note that BUTTON3_MASK has the same value as META_MASK. * @deprecated It is recommended that BUTTON3_DOWN_MASK and
* {@link #getModifiersEx()} be used instead. Note that
* BUTTON3_MASK has the same value as META_MASK.
*/ */
@Deprecated(since = "9")
public static final int BUTTON3_MASK = Event.META_MASK; public static final int BUTTON3_MASK = Event.META_MASK;
/** /**
@ -159,7 +184,7 @@ public abstract class InputEvent extends ComponentEvent {
/** /**
* An array of extended modifiers for additional buttons. * An array of extended modifiers for additional buttons.
* @see getButtonDownMasks * @see #getButtonDownMasks()
* There are twenty buttons fit into 4byte space. * There are twenty buttons fit into 4byte space.
* one more bit is reserved for FIRST_HIGH_BIT. * one more bit is reserved for FIRST_HIGH_BIT.
* @since 1.7 * @since 1.7
@ -382,7 +407,7 @@ public abstract class InputEvent extends ComponentEvent {
* @return whether or not the Shift modifier is down on this event * @return whether or not the Shift modifier is down on this event
*/ */
public boolean isShiftDown() { public boolean isShiftDown() {
return (modifiers & SHIFT_MASK) != 0; return (modifiers & SHIFT_DOWN_MASK) != 0;
} }
/** /**
@ -390,7 +415,7 @@ public abstract class InputEvent extends ComponentEvent {
* @return whether or not the Control modifier is down on this event * @return whether or not the Control modifier is down on this event
*/ */
public boolean isControlDown() { public boolean isControlDown() {
return (modifiers & CTRL_MASK) != 0; return (modifiers & CTRL_DOWN_MASK) != 0;
} }
/** /**
@ -398,7 +423,7 @@ public abstract class InputEvent extends ComponentEvent {
* @return whether or not the Meta modifier is down on this event * @return whether or not the Meta modifier is down on this event
*/ */
public boolean isMetaDown() { public boolean isMetaDown() {
return (modifiers & META_MASK) != 0; return (modifiers & META_DOWN_MASK) != 0;
} }
/** /**
@ -406,7 +431,7 @@ public abstract class InputEvent extends ComponentEvent {
* @return whether or not the Alt modifier is down on this event * @return whether or not the Alt modifier is down on this event
*/ */
public boolean isAltDown() { public boolean isAltDown() {
return (modifiers & ALT_MASK) != 0; return (modifiers & ALT_DOWN_MASK) != 0;
} }
/** /**
@ -414,7 +439,7 @@ public abstract class InputEvent extends ComponentEvent {
* @return whether or not the AltGraph modifier is down on this event * @return whether or not the AltGraph modifier is down on this event
*/ */
public boolean isAltGraphDown() { public boolean isAltGraphDown() {
return (modifiers & ALT_GRAPH_MASK) != 0; return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
} }
/** /**
@ -428,8 +453,12 @@ public abstract class InputEvent extends ComponentEvent {
/** /**
* Returns the modifier mask for this event. * Returns the modifier mask for this event.
*
* @return the modifier mask for this event * @return the modifier mask for this event
* @deprecated It is recommended that extended modifier keys and
* {@link #getModifiersEx()} be used instead
*/ */
@Deprecated(since = "9")
public int getModifiers() { public int getModifiers() {
return modifiers & (JDK_1_3_MODIFIERS | HIGH_MODIFIERS); return modifiers & (JDK_1_3_MODIFIERS | HIGH_MODIFIERS);
} }

View file

@ -1169,6 +1169,7 @@ public class KeyEvent extends InputEvent {
* @see #getKeyLocation() * @see #getKeyLocation()
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("deprecation")
public KeyEvent(Component source, int id, long when, int modifiers, public KeyEvent(Component source, int id, long when, int modifiers,
int keyCode, char keyChar, int keyLocation) { int keyCode, char keyChar, int keyLocation) {
super(source, id, when, modifiers); super(source, id, when, modifiers);
@ -1561,7 +1562,10 @@ public class KeyEvent extends InputEvent {
* @return string a text description of the combination of modifier * @return string a text description of the combination of modifier
* keys that were held down during the event * keys that were held down during the event
* @see InputEvent#getModifiersExText(int) * @see InputEvent#getModifiersExText(int)
* @deprecated It is recommended that extended modifier keys and
* {@link InputEvent#getModifiersExText(int)} be used instead
*/ */
@Deprecated(since = "9")
public static String getKeyModifiersText(int modifiers) { public static String getKeyModifiersText(int modifiers) {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
if ((modifiers & InputEvent.META_MASK) != 0) { if ((modifiers & InputEvent.META_MASK) != 0) {
@ -1696,6 +1700,7 @@ public class KeyEvent extends InputEvent {
* *
* @return a string identifying the event and its attributes * @return a string identifying the event and its attributes
*/ */
@SuppressWarnings("deprecation")
public String paramString() { public String paramString() {
StringBuilder str = new StringBuilder(100); StringBuilder str = new StringBuilder(100);
@ -1821,6 +1826,7 @@ public class KeyEvent extends InputEvent {
* Sets new modifiers by the old ones. The key modifiers * Sets new modifiers by the old ones. The key modifiers
* override overlapping mouse modifiers. * override overlapping mouse modifiers.
*/ */
@SuppressWarnings("deprecation")
private void setNewModifiers() { private void setNewModifiers() {
if ((modifiers & SHIFT_MASK) != 0) { if ((modifiers & SHIFT_MASK) != 0) {
modifiers |= SHIFT_DOWN_MASK; modifiers |= SHIFT_DOWN_MASK;
@ -1845,6 +1851,7 @@ public class KeyEvent extends InputEvent {
/** /**
* Sets old modifiers by the new ones. * Sets old modifiers by the new ones.
*/ */
@SuppressWarnings("deprecation")
private void setOldModifiers() { private void setOldModifiers() {
if ((modifiers & SHIFT_DOWN_MASK) != 0) { if ((modifiers & SHIFT_DOWN_MASK) != 0) {
modifiers |= SHIFT_MASK; modifiers |= SHIFT_MASK;
@ -1871,6 +1878,7 @@ public class KeyEvent extends InputEvent {
* override overlapping mouse modifiers. * override overlapping mouse modifiers.
* @serial * @serial
*/ */
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream s) private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
s.defaultReadObject(); s.defaultReadObject();

View file

@ -733,6 +733,7 @@ public class MouseEvent extends InputEvent {
* @see InputEvent#getMaskForButton(int) * @see InputEvent#getMaskForButton(int)
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("deprecation")
public MouseEvent(Component source, int id, long when, int modifiers, public MouseEvent(Component source, int id, long when, int modifiers,
int x, int y, int xAbs, int yAbs, int x, int y, int xAbs, int yAbs,
int clickCount, boolean popupTrigger, int button) int clickCount, boolean popupTrigger, int button)
@ -943,6 +944,7 @@ public class MouseEvent extends InputEvent {
* @see InputEvent#getModifiersExText(int) * @see InputEvent#getModifiersExText(int)
* @since 1.4 * @since 1.4
*/ */
@SuppressWarnings("deprecation")
public static String getMouseModifiersText(int modifiers) { public static String getMouseModifiersText(int modifiers) {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
if ((modifiers & InputEvent.ALT_MASK) != 0) { if ((modifiers & InputEvent.ALT_MASK) != 0) {
@ -1007,6 +1009,7 @@ public class MouseEvent extends InputEvent {
* *
* @return a string identifying the event and its attributes * @return a string identifying the event and its attributes
*/ */
@SuppressWarnings("deprecation")
public String paramString() { public String paramString() {
StringBuilder str = new StringBuilder(80); StringBuilder str = new StringBuilder(80);
@ -1066,6 +1069,7 @@ public class MouseEvent extends InputEvent {
* Sets new modifiers by the old ones. * Sets new modifiers by the old ones.
* Also sets button. * Also sets button.
*/ */
@SuppressWarnings("deprecation")
private void setNewModifiers() { private void setNewModifiers() {
if ((modifiers & BUTTON1_MASK) != 0) { if ((modifiers & BUTTON1_MASK) != 0) {
modifiers |= BUTTON1_DOWN_MASK; modifiers |= BUTTON1_DOWN_MASK;
@ -1120,6 +1124,7 @@ public class MouseEvent extends InputEvent {
/** /**
* Sets old modifiers by the new ones. * Sets old modifiers by the new ones.
*/ */
@SuppressWarnings("deprecation")
private void setOldModifiers() { private void setOldModifiers() {
if (id == MOUSE_PRESSED if (id == MOUSE_PRESSED
|| id == MOUSE_RELEASED || id == MOUSE_RELEASED
@ -1168,6 +1173,7 @@ public class MouseEvent extends InputEvent {
* Sets new modifiers by the old ones. * Sets new modifiers by the old ones.
* @serial * @serial
*/ */
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream s) private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException { throws IOException, ClassNotFoundException {
s.defaultReadObject(); s.defaultReadObject();

View file

@ -46,5 +46,6 @@ public interface PopupMenuPeer extends MenuPeer {
* *
* @see PopupMenu#show(java.awt.Component, int, int) * @see PopupMenu#show(java.awt.Component, int, int)
*/ */
@SuppressWarnings("deprecation")
void show(Event e); void show(Event e);
} }

View file

@ -82,6 +82,7 @@ class Autoscroller implements ActionListener {
/** /**
* Starts the timer targeting the passed in component. * Starts the timer targeting the passed in component.
*/ */
@SuppressWarnings("deprecation")
private void start(JComponent c, MouseEvent e) { private void start(JComponent c, MouseEvent e) {
Point screenLocation = c.getLocationOnScreen(); Point screenLocation = c.getLocationOnScreen();
@ -156,6 +157,7 @@ class Autoscroller implements ActionListener {
* ActionListener method. Invoked when the Timer fires. This will scroll * ActionListener method. Invoked when the Timer fires. This will scroll
* if necessary. * if necessary.
*/ */
@SuppressWarnings("deprecation")
public void actionPerformed(ActionEvent x) { public void actionPerformed(ActionEvent x) {
JComponent component = Autoscroller.component; JComponent component = Autoscroller.component;

View file

@ -239,6 +239,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable {
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@SuppressWarnings("deprecation")
public void setPressed(boolean b) { public void setPressed(boolean b) {
if((isPressed() == b) || !isEnabled()) { if((isPressed() == b) || !isEnabled()) {
return; return;

View file

@ -1235,6 +1235,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* *
* @see EventListenerList * @see EventListenerList
*/ */
@SuppressWarnings("deprecation")
protected void fireActionEvent() { protected void fireActionEvent() {
if (!firingActionEvent) { if (!firingActionEvent) {
// Set flag to ensure that an infinite loop is not created // Set flag to ensure that an infinite loop is not created

View file

@ -429,6 +429,7 @@ public abstract class JComponent extends Container implements Serializable,
* Returns the Set of <code>KeyStroke</code>s to use if the component * Returns the Set of <code>KeyStroke</code>s to use if the component
* is managing focus for forward focus traversal. * is managing focus for forward focus traversal.
*/ */
@SuppressWarnings("deprecation")
static Set<KeyStroke> getManagingFocusForwardTraversalKeys() { static Set<KeyStroke> getManagingFocusForwardTraversalKeys() {
synchronized(JComponent.class) { synchronized(JComponent.class) {
if (managingFocusForwardTraversalKeys == null) { if (managingFocusForwardTraversalKeys == null) {
@ -445,6 +446,7 @@ public abstract class JComponent extends Container implements Serializable,
* Returns the Set of <code>KeyStroke</code>s to use if the component * Returns the Set of <code>KeyStroke</code>s to use if the component
* is managing focus for backward focus traversal. * is managing focus for backward focus traversal.
*/ */
@SuppressWarnings("deprecation")
static Set<KeyStroke> getManagingFocusBackwardTraversalKeys() { static Set<KeyStroke> getManagingFocusBackwardTraversalKeys() {
synchronized(JComponent.class) { synchronized(JComponent.class) {
if (managingFocusBackwardTraversalKeys == null) { if (managingFocusBackwardTraversalKeys == null) {
@ -2886,6 +2888,7 @@ public abstract class JComponent extends Container implements Serializable,
* *
* @since 1.3 * @since 1.3
*/ */
@SuppressWarnings("deprecation")
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
int condition, boolean pressed) { int condition, boolean pressed) {
InputMap map = getInputMap(condition, false); InputMap map = getInputMap(condition, false);

View file

@ -1754,6 +1754,7 @@ public class JFileChooser extends JComponent implements Accessible {
* the event * the event
* @see EventListenerList * @see EventListenerList
*/ */
@SuppressWarnings("deprecation")
protected void fireActionPerformed(String command) { protected void fireActionPerformed(String command) {
// Guaranteed to return a non-null array // Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();

View file

@ -1516,6 +1516,7 @@ public class JList<E> extends JComponent implements Scrollable, Accessible
* @see JComponent#setToolTipText * @see JComponent#setToolTipText
* @see JComponent#getToolTipText * @see JComponent#getToolTipText
*/ */
@SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) { public String getToolTipText(MouseEvent event) {
if(event != null) { if(event != null) {
Point p = event.getPoint(); Point p = event.getPoint();

View file

@ -412,6 +412,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @param path the <code>MenuElement</code> path array * @param path the <code>MenuElement</code> path array
* @param manager the <code>MenuSelectionManager</code> * @param manager the <code>MenuSelectionManager</code>
*/ */
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) { public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
processMenuDragMouseEvent( processMenuDragMouseEvent(
new MenuDragMouseEvent(e.getComponent(), e.getID(), new MenuDragMouseEvent(e.getComponent(), e.getID(),
@ -435,6 +436,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @param path the <code>MenuElement</code> path array * @param path the <code>MenuElement</code> path array
* @param manager the <code>MenuSelectionManager</code> * @param manager the <code>MenuSelectionManager</code>
*/ */
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) { public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
if (DEBUG) { if (DEBUG) {
System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() + System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +

View file

@ -1385,6 +1385,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* @param path the <code>MenuElement</code> path array * @param path the <code>MenuElement</code> path array
* @param manager the <code>MenuSelectionManager</code> * @param manager the <code>MenuSelectionManager</code>
*/ */
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e, MenuElement path[], public void processKeyEvent(KeyEvent e, MenuElement path[],
MenuSelectionManager manager) { MenuSelectionManager manager) {
MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(), MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),

View file

@ -3410,8 +3410,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
// Convert the event to the renderer's coordinate system // Convert the event to the renderer's coordinate system
Rectangle cellRect = getCellRect(hitRowIndex, hitColumnIndex, false); Rectangle cellRect = getCellRect(hitRowIndex, hitColumnIndex, false);
p.translate(-cellRect.x, -cellRect.y); p.translate(-cellRect.x, -cellRect.y);
@SuppressWarnings("deprecation")
final int modifiers = event.getModifiers();
MouseEvent newEvent = new MouseEvent(component, event.getID(), MouseEvent newEvent = new MouseEvent(component, event.getID(),
event.getWhen(), event.getModifiers(), event.getWhen(), modifiers,
p.x, p.y, p.x, p.y,
event.getXOnScreen(), event.getXOnScreen(),
event.getYOnScreen(), event.getYOnScreen(),

View file

@ -485,6 +485,7 @@ public class JTextField extends JTextComponent implements SwingConstants {
* first order. * first order.
* @see EventListenerList * @see EventListenerList
*/ */
@SuppressWarnings("deprecation")
protected void fireActionPerformed() { protected void fireActionPerformed() {
// Guaranteed to return a non-null array // Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList(); Object[] listeners = listenerList.getListenerList();

View file

@ -372,6 +372,7 @@ public class JToggleButton extends AbstractButton implements Accessible {
/** /**
* Sets the pressed state of the toggle button. * Sets the pressed state of the toggle button.
*/ */
@SuppressWarnings("deprecation")
public void setPressed(boolean b) { public void setPressed(boolean b) {
if ((isPressed() == b) || !isEnabled()) { if ((isPressed() == b) || !isEnabled()) {
return; return;

View file

@ -1568,9 +1568,10 @@ public class JTree extends JComponent implements Scrollable, Accessible
Rectangle pathBounds = getPathBounds(path); Rectangle pathBounds = getPathBounds(path);
p.translate(-pathBounds.x, -pathBounds.y); p.translate(-pathBounds.x, -pathBounds.y);
@SuppressWarnings("deprecation")
final int modifiers = event.getModifiers();
newEvent = new MouseEvent(rComponent, event.getID(), newEvent = new MouseEvent(rComponent, event.getID(),
event.getWhen(), event.getWhen(), modifiers,
event.getModifiers(),
p.x, p.y, p.x, p.y,
event.getXOnScreen(), event.getXOnScreen(),
event.getYOnScreen(), event.getYOnScreen(),

View file

@ -207,6 +207,7 @@ class KeyboardManager {
* want a crack at the event. * want a crack at the event.
* If one of them wants it, then it will "DO-THE-RIGHT-THING" * If one of them wants it, then it will "DO-THE-RIGHT-THING"
*/ */
@SuppressWarnings("deprecation")
public boolean fireKeyboardAction(KeyEvent e, boolean pressed, Container topAncestor) { public boolean fireKeyboardAction(KeyEvent e, boolean pressed, Container topAncestor) {
if (e.isConsumed()) { if (e.isConsumed()) {

View file

@ -212,6 +212,7 @@ public class MenuSelectionManager {
* *
* @param event a MouseEvent object * @param event a MouseEvent object
*/ */
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent event) { public void processMouseEvent(MouseEvent event) {
int screenX,screenY; int screenX,screenY;
Point p; Point p;

View file

@ -346,6 +346,7 @@ public class SwingUtilities implements SwingConstants
* *
* @return the new mouse event * @return the new mouse event
*/ */
@SuppressWarnings("deprecation")
public static MouseEvent convertMouseEvent(Component source, public static MouseEvent convertMouseEvent(Component source,
MouseEvent sourceEvent, MouseEvent sourceEvent,
Component destination) { Component destination) {

View file

@ -89,6 +89,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/ */
protected boolean heavyWeightPopupEnabled = false; protected boolean heavyWeightPopupEnabled = false;
@SuppressWarnings("deprecation")
ToolTipManager() { ToolTipManager() {
enterTimer = new Timer(750, new insideTimerAction()); enterTimer = new Timer(750, new insideTimerAction());
enterTimer.setRepeats(false); enterTimer.setRepeats(false);

View file

@ -1839,6 +1839,7 @@ public class BasicComboBoxUI extends ComboBoxUI {
// key. If it finds a key event that wasn't a navigation key it // key. If it finds a key event that wasn't a navigation key it
// dispatches it to JComboBox.selectWithKeyChar() so that it can do // dispatches it to JComboBox.selectWithKeyChar() so that it can do
// type-ahead. // type-ahead.
@SuppressWarnings("deprecation")
public void keyPressed( KeyEvent e ) { public void keyPressed( KeyEvent e ) {
if ( isNavigationKey(e.getKeyCode(), e.getModifiers()) ) { if ( isNavigationKey(e.getKeyCode(), e.getModifiers()) ) {
lastTime = 0L; lastTime = 0L;

View file

@ -528,6 +528,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
*/ */
protected JList<Object> createList() { protected JList<Object> createList() {
return new JList<Object>( comboBox.getModel() ) { return new JList<Object>( comboBox.getModel() ) {
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e) { public void processMouseEvent(MouseEvent e) {
if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) { if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
// Fix for 4234053. Filter out the Control Key from the list. // Fix for 4234053. Filter out the Control Key from the list.
@ -1238,6 +1239,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
protected MouseEvent convertMouseEvent( MouseEvent e ) { protected MouseEvent convertMouseEvent( MouseEvent e ) {
Point convertedPoint = SwingUtilities.convertPoint( (Component)e.getSource(), Point convertedPoint = SwingUtilities.convertPoint( (Component)e.getSource(),
e.getPoint(), list ); e.getPoint(), list );
@SuppressWarnings("deprecation")
MouseEvent newEvent = new MouseEvent( (Component)e.getSource(), MouseEvent newEvent = new MouseEvent( (Component)e.getSource(),
e.getID(), e.getID(),
e.getWhen(), e.getWhen(),

View file

@ -382,6 +382,7 @@ public class BasicGraphicsUtils
return c.getComponentOrientation().isLeftToRight(); return c.getComponentOrientation().isLeftToRight();
} }
@SuppressWarnings("deprecation")
static boolean isMenuShortcutKeyDown(InputEvent event) { static boolean isMenuShortcutKeyDown(InputEvent event) {
return (event.getModifiers() & return (event.getModifiers() &
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0; Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0;

View file

@ -1024,7 +1024,7 @@ public class BasicInternalFrameUI extends InternalFrameUI
return; return;
} }
} }
@SuppressWarnings("deprecation")
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if ( startingBounds == null ) { if ( startingBounds == null ) {

View file

@ -1026,6 +1026,7 @@ public class BasicMenuItemUI extends MenuItemUI
manager.processMouseEvent(e); manager.processMouseEvent(e);
} }
} }
@SuppressWarnings("deprecation")
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
MenuSelectionManager manager = MenuSelectionManager.defaultManager(); MenuSelectionManager manager = MenuSelectionManager.defaultManager();
int modifiers = e.getModifiers(); int modifiers = e.getModifiers();
@ -1037,6 +1038,7 @@ public class BasicMenuItemUI extends MenuItemUI
manager.setSelectedPath(getPath()); manager.setSelectedPath(getPath());
} }
} }
@SuppressWarnings("deprecation")
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
MenuSelectionManager manager = MenuSelectionManager.defaultManager(); MenuSelectionManager manager = MenuSelectionManager.defaultManager();

View file

@ -123,6 +123,7 @@ public class BasicMenuUI extends BasicMenuItemUI
getPropertyPrefix() + ".actionMap"); getPropertyPrefix() + ".actionMap");
} }
@SuppressWarnings("deprecation")
void updateMnemonicBinding() { void updateMnemonicBinding() {
int mnemonic = menuItem.getModel().getMnemonic(); int mnemonic = menuItem.getModel().getMnemonic();
int[] shortcutKeys = (int[])DefaultLookup.get(menuItem, this, int[] shortcutKeys = (int[])DefaultLookup.get(menuItem, this,

View file

@ -268,6 +268,7 @@ public class BasicPopupMenuUI extends PopupMenuUI {
return list; return list;
} }
@SuppressWarnings("deprecation")
public boolean isPopupTrigger(MouseEvent e) { public boolean isPopupTrigger(MouseEvent e) {
return ((e.getID()==MouseEvent.MOUSE_RELEASED) return ((e.getID()==MouseEvent.MOUSE_RELEASED)
&& ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0)); && ((e.getModifiers() & MouseEvent.BUTTON3_MASK)!=0));

View file

@ -328,6 +328,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
/** /**
* Installs the UI defaults. * Installs the UI defaults.
*/ */
@SuppressWarnings("deprecation")
protected void installDefaults(){ protected void installDefaults(){
LookAndFeel.installBorder(splitPane, "SplitPane.border"); LookAndFeel.installBorder(splitPane, "SplitPane.border");
LookAndFeel.installColors(splitPane, "SplitPane.background", LookAndFeel.installColors(splitPane, "SplitPane.background",

View file

@ -868,6 +868,7 @@ public class BasicTableUI extends TableUI
public void keyReleased(KeyEvent e) { } public void keyReleased(KeyEvent e) { }
@SuppressWarnings("deprecation")
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
KeyStroke keyStroke = KeyStroke.getKeyStroke(e.getKeyChar(), KeyStroke keyStroke = KeyStroke.getKeyStroke(e.getKeyChar(),
e.getModifiers()); e.getModifiers());

View file

@ -525,7 +525,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* adding 'TAB' and 'SHIFT-TAB' to traversalKeysSet in case * adding 'TAB' and 'SHIFT-TAB' to traversalKeysSet in case
* editor is non editable * editor is non editable
*/ */
@SuppressWarnings("deprecation")
void updateFocusTraversalKeys() { void updateFocusTraversalKeys() {
/* /*
* Fix for 4514331 Non-editable JTextArea and similar * Fix for 4514331 Non-editable JTextArea and similar

View file

@ -898,6 +898,7 @@ public class MetalRootPaneUI extends BasicRootPaneUI
w.setCursor(lastCursor); w.setCursor(lastCursor);
} }
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent ev) { public void mouseClicked(MouseEvent ev) {
Window w = (Window)ev.getSource(); Window w = (Window)ev.getSource();
Frame f = null; Frame f = null;

View file

@ -192,6 +192,7 @@ public class MetalToolTipUI extends BasicToolTipUI {
// that subclasses that randomly invoke this method will see varying // that subclasses that randomly invoke this method will see varying
// results. If this becomes an issue, MetalToolTipUI should no longer be // results. If this becomes an issue, MetalToolTipUI should no longer be
// shared. // shared.
@SuppressWarnings("deprecation")
public String getAcceleratorString() { public String getAcceleratorString() {
if (tip == null || isAcceleratorHidden()) { if (tip == null || isAcceleratorHidden()) {
return ""; return "";

View file

@ -80,6 +80,7 @@ public class SynthSplitPaneUI extends BasicSplitPaneUI
* Installs the UI defaults. * Installs the UI defaults.
*/ */
@Override @Override
@SuppressWarnings("deprecation")
protected void installDefaults() { protected void installDefaults() {
updateStyle(splitPane); updateStyle(splitPane);

View file

@ -384,6 +384,7 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
* renderer and, therefore, the proper tip * renderer and, therefore, the proper tip
* @return the tool tip for this component * @return the tool tip for this component
*/ */
@SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) { public String getToolTipText(MouseEvent event) {
String tip = null; String tip = null;
Point p = event.getPoint(); Point p = event.getPoint();

View file

@ -372,6 +372,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
/** /**
* Selects word based on the MouseEvent * Selects word based on the MouseEvent
*/ */
@SuppressWarnings("deprecation")
private void selectWord(MouseEvent e) { private void selectWord(MouseEvent e) {
if (selectedWordEvent != null if (selectedWordEvent != null
&& selectedWordEvent.getX() == e.getX() && selectedWordEvent.getX() == e.getX()
@ -405,6 +406,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
* @param e the mouse event * @param e the mouse event
* @see MouseListener#mouseClicked * @see MouseListener#mouseClicked
*/ */
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (getComponent() == null) { if (getComponent() == null) {
return; return;
@ -513,6 +515,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
/** /**
* Adjusts the caret location based on the MouseEvent. * Adjusts the caret location based on the MouseEvent.
*/ */
@SuppressWarnings("deprecation")
private void adjustCaret(MouseEvent e) { private void adjustCaret(MouseEvent e) {
if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 && if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 &&
getDot() != -1) { getDot() != -1) {

View file

@ -4103,6 +4103,7 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
get(FOCUSED_COMPONENT); get(FOCUSED_COMPONENT);
} }
@SuppressWarnings("deprecation")
private int getCurrentEventModifiers() { private int getCurrentEventModifiers() {
int modifiers = 0; int modifiers = 0;
AWTEvent currentEvent = EventQueue.getCurrentEvent(); AWTEvent currentEvent = EventQueue.getCurrentEvent();

View file

@ -126,6 +126,7 @@ public class NullComponentPeer implements LightweightPeer,
public void coalescePaintEvent(PaintEvent e) { public void coalescePaintEvent(PaintEvent e) {
} }
@SuppressWarnings("deprecation")
public boolean handleEvent(Event e) { public boolean handleEvent(Event e) {
return false; return false;
} }

View file

@ -1049,6 +1049,7 @@ public abstract class SunToolkit extends Toolkit
/** /**
* Returns key modifiers used by Swing to set up a focus accelerator key stroke. * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
*/ */
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() { public int getFocusAcceleratorKeyMask() {
return InputEvent.ALT_MASK; return InputEvent.ALT_MASK;
} }
@ -1059,6 +1060,7 @@ public abstract class SunToolkit extends Toolkit
* the way things work on Windows: here, pressing ctrl + alt allows user to enter * the way things work on Windows: here, pressing ctrl + alt allows user to enter
* characters from the extended character set (like euro sign or math symbols) * characters from the extended character set (like euro sign or math symbols)
*/ */
@SuppressWarnings("deprecation")
public boolean isPrintableCharacterModifiersMask(int mods) { public boolean isPrintableCharacterModifiersMask(int mods) {
return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK)); return ((mods & InputEvent.ALT_MASK) == (mods & InputEvent.CTRL_MASK));
} }

View file

@ -1831,6 +1831,7 @@ public class FilePane extends JPanel implements PropertyChangeListener {
private class Handler implements MouseListener { private class Handler implements MouseListener {
private MouseListener doubleClickListener; private MouseListener doubleClickListener;
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent evt) { public void mouseClicked(MouseEvent evt) {
JComponent source = (JComponent)evt.getSource(); JComponent source = (JComponent)evt.getSource();

View file

@ -175,6 +175,7 @@ public class MenuItemLayoutHelper {
arrowSize.origWidth = arrowSize.width; arrowSize.origWidth = arrowSize.width;
} }
@SuppressWarnings("deprecation")
private String getAccText(String acceleratorDelimiter) { private String getAccText(String acceleratorDelimiter) {
String accText = ""; String accText = "";
KeyStroke accelerator = mi.getAccelerator(); KeyStroke accelerator = mi.getAccelerator();

View file

@ -1460,7 +1460,7 @@ public class SwingUtilities2 {
* *
* @param ie InputEvent to check * @param ie InputEvent to check
*/ */
@SuppressWarnings("deprecation")
private static boolean isAccessClipboardGesture(InputEvent ie) { private static boolean isAccessClipboardGesture(InputEvent ie) {
boolean allowedGesture = false; boolean allowedGesture = false;
if (ie instanceof KeyEvent) { //we can validate only keyboard gestures if (ie instanceof KeyEvent) { //we can validate only keyboard gestures
@ -2129,6 +2129,7 @@ public class SwingUtilities2 {
return -1; return -1;
} }
@SuppressWarnings("deprecation")
public static int getSystemMnemonicKeyMask() { public static int getSystemMnemonicKeyMask() {
Toolkit toolkit = Toolkit.getDefaultToolkit(); Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof SunToolkit) { if (toolkit instanceof SunToolkit) {

View file

@ -429,7 +429,7 @@ public abstract class InfoWindow extends Window {
gtkImagesLoaded = true; gtkImagesLoaded = true;
} }
} }
@SuppressWarnings("deprecation")
private class ActionPerformer extends MouseAdapter { private class ActionPerformer extends MouseAdapter {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
// hide the balloon by any click // hide the balloon by any click

View file

@ -385,7 +385,7 @@ final class ListHelper implements XScrollbarClient {
} }
return false; return false;
} }
@SuppressWarnings("deprecation")
void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) { void handleVSBEvent(MouseEvent e, Rectangle bounds, int x, int y) {
int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height; int sbHeight = hsbVis ? bounds.height - SCROLLBAR_WIDTH : bounds.height;

View file

@ -1087,7 +1087,9 @@ public abstract class XBaseMenuWindow extends XWindow {
} }
} else { } else {
//Invoke action event //Invoke action event
item.action(mouseEvent.getWhen(), mouseEvent.getModifiers()); @SuppressWarnings("deprecation")
final int modifiers = mouseEvent.getModifiers();
item.action(mouseEvent.getWhen(), modifiers);
ungrabInput(); ungrabInput();
} }
} else { } else {
@ -1200,7 +1202,9 @@ public abstract class XBaseMenuWindow extends XWindow {
if (citem instanceof XMenuPeer) { if (citem instanceof XMenuPeer) {
cwnd.selectItem(citem, true); cwnd.selectItem(citem, true);
} else if (citem != null) { } else if (citem != null) {
citem.action(event.getWhen(), event.getModifiers()); @SuppressWarnings("deprecation")
final int modifiers = event.getModifiers();
citem.action(event.getWhen(), modifiers);
ungrabInput(); ungrabInput();
} }
break; break;

View file

@ -120,7 +120,9 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
if (XToolkit.isLeftMouseButton(e)) { if (XToolkit.isLeftMouseButton(e)) {
if (armed) if (armed)
{ {
action(e.getWhen(),e.getModifiers()); @SuppressWarnings("deprecation")
final int modifiers = e.getModifiers();
action(e.getWhen(), modifiers);
} }
pressed = false; pressed = false;
armed = false; armed = false;
@ -168,7 +170,9 @@ public class XButtonPeer extends XComponentPeer implements ButtonPeer {
pressed=true; pressed=true;
armed=true; armed=true;
repaint(); repaint();
action(e.getWhen(),e.getModifiers()); @SuppressWarnings("deprecation")
final int modifiers = e.getModifiers();
action(e.getWhen(), modifiers);
} }
break; break;

View file

@ -482,7 +482,7 @@ public class XChoicePeer extends XComponentPeer implements ChoicePeer, ToplevelS
firstPress = false; firstPress = false;
dragStartIdx = -1; dragStartIdx = -1;
} }
@SuppressWarnings("deprecation")
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
/* /*
* fix for 5003166. On Motif user are unable to drag * fix for 5003166. On Motif user are unable to drag

View file

@ -452,6 +452,7 @@ public class XEmbedServerTester implements XEventDispatcher {
waitWindowActivated(res); waitWindowActivated(res);
return res; return res;
} }
@SuppressWarnings("deprecation")
private int activateServerNoWait(int prev) { private int activateServerNoWait(int prev) {
xembedLog.fine("Activating server"); xembedLog.fine("Activating server");
int res = getEventPos(); int res = getEventPos();
@ -467,6 +468,7 @@ public class XEmbedServerTester implements XEventDispatcher {
robot.mouseRelease(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK);
return res; return res;
} }
@SuppressWarnings("deprecation")
private int deactivateServer() { private int deactivateServer() {
xembedLog.fine("Deactivating server"); xembedLog.fine("Deactivating server");
int res = getEventPos(); int res = getEventPos();
@ -480,6 +482,7 @@ public class XEmbedServerTester implements XEventDispatcher {
waitWindowDeactivated(res); waitWindowDeactivated(res);
return res; return res;
} }
@SuppressWarnings("deprecation")
private int focusServer() { private int focusServer() {
xembedLog.fine("Focusing server"); xembedLog.fine("Focusing server");
boolean weFocused = focused; boolean weFocused = focused;
@ -740,6 +743,7 @@ public class XEmbedServerTester implements XEventDispatcher {
private void ungrabKey() { private void ungrabKey() {
sendMessage(XEmbedHelper.NON_STANDARD_XEMBED_GTK_UNGRAB_KEY, 0, accel_keysym, accel_mods); sendMessage(XEmbedHelper.NON_STANDARD_XEMBED_GTK_UNGRAB_KEY, 0, accel_keysym, accel_mods);
} }
@SuppressWarnings("deprecation")
private int showModalDialog() { private int showModalDialog() {
xembedLog.fine("Showing modal dialog"); xembedLog.fine("Showing modal dialog");
int res = getEventPos(); int res = getEventPos();

View file

@ -573,7 +573,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
repaint(); repaint();
} }
} }
@SuppressWarnings("deprecation")
void mousePressed(MouseEvent mouseEvent) { void mousePressed(MouseEvent mouseEvent) {
if (log.isLoggable(PlatformLogger.Level.FINER)) { if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis); log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis);
@ -641,6 +641,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
isMousePressed = true; isMousePressed = true;
} }
} }
@SuppressWarnings("deprecation")
void mouseReleased(MouseEvent mouseEvent) { void mouseReleased(MouseEvent mouseEvent) {
if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
//winReleaseCursorFocus(); //winReleaseCursorFocus();
@ -685,6 +686,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
} }
} }
@SuppressWarnings("deprecation")
void mouseDragged(MouseEvent mouseEvent) { void mouseDragged(MouseEvent mouseEvent) {
// TODO: can you drag w/ any other buttons? what about multiple buttons? // TODO: can you drag w/ any other buttons? what about multiple buttons?
if (isEnabled() && if (isEnabled() &&
@ -810,7 +812,7 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
break; break;
} }
} }
@SuppressWarnings("deprecation")
void keyPressed(KeyEvent e) { void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode(); int keyCode = e.getKeyCode();
if (log.isLoggable(PlatformLogger.Level.FINE)) { if (log.isLoggable(PlatformLogger.Level.FINE)) {

View file

@ -503,6 +503,7 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
* This function is called from XWindow * This function is called from XWindow
* @see XWindow.handleF10onEDT() * @see XWindow.handleF10onEDT()
*/ */
@SuppressWarnings("deprecation")
void handleF10KeyPress(KeyEvent event) { void handleF10KeyPress(KeyEvent event) {
int keyState = event.getModifiers(); int keyState = event.getModifiers();
if (((keyState & InputEvent.ALT_MASK) != 0) || if (((keyState & InputEvent.ALT_MASK) != 0) ||

View file

@ -131,6 +131,7 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
/* /*
* From PopupMenuPeer * From PopupMenuPeer
*/ */
@SuppressWarnings("deprecation")
public void show(Event e) { public void show(Event e) {
target = (Component)e.target; target = (Component)e.target;
// Get menus from the target. // Get menus from the target.

View file

@ -468,6 +468,7 @@ class XScrollPanePeer extends XComponentPeer implements ScrollPanePeer, XScrollb
* MouseEvent.MOUSE_EXITED * MouseEvent.MOUSE_EXITED
* MouseEvent.MOUSE_DRAGGED * MouseEvent.MOUSE_DRAGGED
*/ */
@SuppressWarnings("deprecation")
public void handleJavaMouseEvent( MouseEvent mouseEvent ) { public void handleJavaMouseEvent( MouseEvent mouseEvent ) {
super.handleJavaMouseEvent(mouseEvent); super.handleJavaMouseEvent(mouseEvent);
int modifiers = mouseEvent.getModifiers(); int modifiers = mouseEvent.getModifiers();

View file

@ -457,6 +457,7 @@ abstract class XScrollbar {
* MouseEvent.MOUSE_EXITED * MouseEvent.MOUSE_EXITED
* MouseEvent.MOUSE_DRAGGED * MouseEvent.MOUSE_DRAGGED
*/ */
@SuppressWarnings("deprecation")
public void handleMouseEvent(int id, int modifiers, int x, int y) { public void handleMouseEvent(int id, int modifiers, int x, int y) {
if ((modifiers & InputEvent.BUTTON1_MASK) == 0) { if ((modifiers & InputEvent.BUTTON1_MASK) == 0) {
return; return;

View file

@ -126,6 +126,7 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
* MouseEvent.MOUSE_EXITED * MouseEvent.MOUSE_EXITED
* MouseEvent.MOUSE_DRAGGED * MouseEvent.MOUSE_DRAGGED
*/ */
@SuppressWarnings("deprecation")
public void handleJavaMouseEvent( MouseEvent mouseEvent ) { public void handleJavaMouseEvent( MouseEvent mouseEvent ) {
super.handleJavaMouseEvent(mouseEvent); super.handleJavaMouseEvent(mouseEvent);

View file

@ -1344,6 +1344,7 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
} }
} }
@SuppressWarnings("deprecation")
private static MouseEvent newMouseEvent( private static MouseEvent newMouseEvent(
Component source, Point point, MouseEvent template ) Component source, Point point, MouseEvent template )
{ {

View file

@ -477,6 +477,7 @@ public class XTrayIconPeer implements TrayIconPeer,
e.setSource(xtiPeer.target); e.setSource(xtiPeer.target);
XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e); XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e);
} }
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if ((e.getClickCount() == 1 || xtiPeer.balloon.isVisible()) && if ((e.getClickCount() == 1 || xtiPeer.balloon.isVisible()) &&
e.getButton() == MouseEvent.BUTTON1) e.getButton() == MouseEvent.BUTTON1)

View file

@ -621,7 +621,7 @@ class XWindow extends XBaseWindow implements X11ComponentPeer {
// 4 and 5 buttons are usually considered assigned to a first wheel // 4 and 5 buttons are usually considered assigned to a first wheel
return button == XConstants.buttons[3] || button == XConstants.buttons[4]; return button == XConstants.buttons[3] || button == XConstants.buttons[4];
} }
@SuppressWarnings("deprecation")
static int getXModifiers(AWTKeyStroke stroke) { static int getXModifiers(AWTKeyStroke stroke) {
int mods = stroke.getModifiers(); int mods = stroke.getModifiers();
int res = 0; int res = 0;

View file

@ -95,6 +95,7 @@ final class WButtonPeer extends WComponentPeer implements ButtonPeer {
private static native void initIDs(); private static native void initIDs();
@Override @Override
@SuppressWarnings("deprecation")
public boolean handleJavaKeyEvent(KeyEvent e) { public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) { switch (e.getID()) {
case KeyEvent.KEY_RELEASED: case KeyEvent.KEY_RELEASED:

View file

@ -263,6 +263,7 @@ final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
void disable() {} void disable() {}
@Override @Override
public void reshape(int x, int y, int width, int height) {} public void reshape(int x, int y, int width, int height) {}
@SuppressWarnings("deprecation")
public boolean handleEvent(Event e) { return false; } public boolean handleEvent(Event e) { return false; }
@Override @Override
public void setForeground(Color c) {} public void setForeground(Color c) {}

View file

@ -70,6 +70,7 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
private native void createMenu(WComponentPeer parent); private native void createMenu(WComponentPeer parent);
@SuppressWarnings("deprecation")
public void show(Event e) { public void show(Event e) {
Component origin = (Component)e.target; Component origin = (Component)e.target;
WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin); WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin);
@ -97,6 +98,7 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
*/ */
void show(Component origin, Point p) { void show(Component origin, Point p) {
WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin); WComponentPeer peer = (WComponentPeer) WToolkit.targetToPeer(origin);
@SuppressWarnings("deprecation")
Event e = new Event(origin, 0, Event.MOUSE_DOWN, p.x, p.y, 0, 0); Event e = new Event(origin, 0, Event.MOUSE_DOWN, p.x, p.y, 0, 0);
if (peer == null) { if (peer == null) {
Component nativeOrigin = WToolkit.getNativeContainer(origin); Component nativeOrigin = WToolkit.getNativeContainer(origin);
@ -107,5 +109,6 @@ final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
_show(e); _show(e);
} }
@SuppressWarnings("deprecation")
private native void _show(Event e); private native void _show(Event e);
} }

View file

@ -135,6 +135,7 @@ class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
void disable() {} void disable() {}
@Override @Override
public void reshape(int x, int y, int width, int height) {} public void reshape(int x, int y, int width, int height) {}
@SuppressWarnings("deprecation")
public boolean handleEvent(Event e) { return false; } public boolean handleEvent(Event e) { return false; }
@Override @Override
public void setForeground(Color c) {} public void setForeground(Color c) {}

View file

@ -43,6 +43,7 @@ final class WTextFieldPeer extends WTextComponentPeer implements TextFieldPeer {
} }
@Override @Override
@SuppressWarnings("deprecation")
public boolean handleJavaKeyEvent(KeyEvent e) { public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) { switch (e.getID()) {
case KeyEvent.KEY_TYPED: case KeyEvent.KEY_TYPED:

View file

@ -128,7 +128,7 @@ public class JConsole extends JFrame
hotspotMI.setMnemonic(Resources.getMnemonicInt(Messages.HOTSPOT_MBEANS_ELLIPSIS)); hotspotMI.setMnemonic(Resources.getMnemonicInt(Messages.HOTSPOT_MBEANS_ELLIPSIS));
hotspotMI.setAccelerator(KeyStroke. hotspotMI.setAccelerator(KeyStroke.
getKeyStroke(KeyEvent.VK_H, getKeyStroke(KeyEvent.VK_H,
InputEvent.CTRL_MASK)); InputEvent.CTRL_DOWN_MASK));
hotspotMI.addActionListener(this); hotspotMI.addActionListener(this);
connectionMenu.add(hotspotMI); connectionMenu.add(hotspotMI);
@ -138,7 +138,7 @@ public class JConsole extends JFrame
connectMI = new JMenuItem(Messages.NEW_CONNECTION_ELLIPSIS); connectMI = new JMenuItem(Messages.NEW_CONNECTION_ELLIPSIS);
connectMI.setMnemonic(Resources.getMnemonicInt(Messages.NEW_CONNECTION_ELLIPSIS)); connectMI.setMnemonic(Resources.getMnemonicInt(Messages.NEW_CONNECTION_ELLIPSIS));
connectMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, connectMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
InputEvent.CTRL_MASK)); InputEvent.CTRL_DOWN_MASK));
connectMI.addActionListener(this); connectMI.addActionListener(this);
connectionMenu.add(connectMI); connectionMenu.add(connectMI);
@ -147,7 +147,7 @@ public class JConsole extends JFrame
exitMI = new JMenuItem(Messages.EXIT); exitMI = new JMenuItem(Messages.EXIT);
exitMI.setMnemonic(Resources.getMnemonicInt(Messages.EXIT)); exitMI.setMnemonic(Resources.getMnemonicInt(Messages.EXIT));
exitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, exitMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4,
InputEvent.ALT_MASK)); InputEvent.ALT_DOWN_MASK));
exitMI.addActionListener(this); exitMI.addActionListener(this);
connectionMenu.add(exitMI); connectionMenu.add(exitMI);
@ -223,7 +223,7 @@ public class JConsole extends JFrame
tileMI = new JMenuItem(Messages.TILE); tileMI = new JMenuItem(Messages.TILE);
tileMI.setMnemonic(Resources.getMnemonicInt(Messages.TILE)); tileMI.setMnemonic(Resources.getMnemonicInt(Messages.TILE));
tileMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, tileMI.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,
InputEvent.CTRL_MASK)); InputEvent.CTRL_DOWN_MASK));
tileMI.addActionListener(JConsole.this); tileMI.addActionListener(JConsole.this);
add(tileMI); add(tileMI);

View file

@ -124,7 +124,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
addMouseListener(new MouseAdapter() { addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (connectedIconBounds != null && (e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && connectedIconBounds.contains(e.getPoint())) { if (connectedIconBounds != null
&& (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0
&& connectedIconBounds.contains(e.getPoint())) {
if (isConnected()) { if (isConnected()) {
userDisconnected = true; userDisconnected = true;

View file

@ -438,7 +438,7 @@ public class Utils {
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
// Accept "copy" key strokes // Accept "copy" key strokes
KeyStroke ks = KeyStroke.getKeyStroke( KeyStroke ks = KeyStroke.getKeyStroke(
e.getKeyCode(), e.getModifiers()); e.getKeyCode(), e.getModifiersEx());
JComponent comp = (JComponent) e.getSource(); JComponent comp = (JComponent) e.getSource();
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
InputMap im = comp.getInputMap(i); InputMap im = comp.getInputMap(i);