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() {
return new JList<Object>(comboBox.getModel()) {
@Override
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e) {
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);
}

View file

@ -137,6 +137,7 @@ public final class AquaInternalFrameDockIconUI extends DesktopIconUI
}
@Override
@SuppressWarnings("deprecation")
public void mouseEntered(final MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) return;
String title = fFrame.getTitle();
@ -146,6 +147,7 @@ public final class AquaInternalFrameDockIconUI extends DesktopIconUI
}
@Override
@SuppressWarnings("deprecation")
public void mouseExited(final MouseEvent e) {
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
@SuppressWarnings("deprecation")
public void mouseDragged(final MouseEvent e) {
// do not forward drags
// if (didForwardEvent(e)) return;
@ -621,7 +622,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
return didForwardEvent;
}
@SuppressWarnings("deprecation")
boolean didForwardEventInternal(final MouseEvent e) {
if (fDraggingFrame) return false;
@ -927,11 +928,15 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
return (w - x) + (h - y) < 12;
}
@SuppressWarnings("deprecation")
void forwardEventToFrame(final MouseEvent e) {
final Point pt = new Point();
final Component c = getComponentToForwardTo(e, pt);
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) {
@ -993,6 +998,7 @@ public class AquaInternalFrameUI extends BasicInternalFrameUI implements SwingCo
public void mouseMoved(final MouseEvent e) { }
@Override
@SuppressWarnings("deprecation")
public void mouseWheelMoved(final MouseWheelEvent e) {
final Point pt = new Point();
final Component c = getComponentToForwardTo(e, pt);

View file

@ -74,7 +74,10 @@ public class AquaMenuPainter {
kUCapsLockGlyph = 0x21EA;
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 {
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
@SuppressWarnings("deprecation")
private static String getKeyModifiersUnicode(final int modifiers, final boolean isLeftToRight) {
final StringBuilder buf = new StringBuilder(2);
// 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.
*/
@SuppressWarnings("deprecation")
private void addMnemonic(final int index, final int mnemonic) {
if (mnemonicToIndexMap == null) {
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
* swing delegate.
*/
@SuppressWarnings("deprecation")
private AWTEvent createDelegateEvent(final AWTEvent e) {
// TODO modifiers should be changed to getModifiers()|getModifiersEx()?
AWTEvent delegateEvent = null;

View file

@ -302,6 +302,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
@Override
@SuppressWarnings("deprecation")
protected void processMouseEvent(final MouseEvent e) {
super.processMouseEvent(e);
if (e.getID() == MouseEvent.MOUSE_CLICKED && e.getClickCount() == 2) {
@ -314,6 +315,7 @@ final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
}
@Override
@SuppressWarnings("deprecation")
protected void processKeyEvent(final KeyEvent e) {
super.processKeyEvent(e);
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();
Point dragOrigin = new Point(trigger.getDragOrigin());
@SuppressWarnings("deprecation")
int extModifiers = (triggerEvent.getModifiers() | triggerEvent.getModifiersEx());
long timestamp = triggerEvent.getWhen();
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());
return parent.executeGet(ptr->nativeCreate(ptr, isSeparator()));
}
@SuppressWarnings("deprecation")
public void setLabel(String label, char keyChar, int keyCode, int modifiers) {
int keyMask = modifiers;
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);
@Override
@SuppressWarnings("deprecation")
public void show(Event e) {
Component origin = (Component)e.target;
if (origin != null) {

View file

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

View file

@ -532,6 +532,7 @@ public final class LWCToolkit extends LWToolkit {
* @since 1.1
*/
@Override
@SuppressWarnings("deprecation")
public int getMenuShortcutKeyMask() {
return Event.META_MASK;
}
@ -768,6 +769,7 @@ public final class LWCToolkit extends LWToolkit {
* stroke.
*/
@Override
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() {
return InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
}
@ -777,6 +779,7 @@ public final class LWCToolkit extends LWToolkit {
* printable character.
*/
@Override
@SuppressWarnings("deprecation")
public boolean isPrintableCharacterModifiersMask(int mods) {
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) {
getParent().dispatchEvent(new MouseEvent(
getParent(), e.getID(), e.getWhen(), e.getModifiers(),
@ -329,7 +329,7 @@ public class MotifDesktopIconUI extends BasicDesktopIconUI
}
});
}
@SuppressWarnings("deprecation")
void forwardEventToParent(MouseEvent e) {
getParent().dispatchEvent(new MouseEvent(
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
* override it, this will not cause any visible effect.
*/
@Deprecated(since = "9")
public static void paintMenuItem(Graphics g, JComponent c,
Icon checkIcon, Icon arrowIcon,
Color background, Color foreground,

View file

@ -361,7 +361,7 @@ public class MotifInternalFrameTitlePane
}
});
}
@SuppressWarnings("deprecation")
void forwardEventToParent(MouseEvent e) {
getParent().dispatchEvent(new MouseEvent(
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);
@SuppressWarnings("deprecation")
final int metaMask = KeyEvent.META_MASK;
Object[] defaults = {
"Desktop.background", table.get("desktop"),
@ -635,8 +636,7 @@ public class MotifLookAndFeel extends BasicLookAndFeel
"Menu.submenuPopupOffsetX", -2,
"Menu.submenuPopupOffsetY", 3,
"Menu.shortcutKeys", new int[]{
SwingUtilities2.getSystemMnemonicKeyMask(),
KeyEvent.META_MASK
SwingUtilities2.getSystemMnemonicKeyMask(), metaMask
},
"Menu.cancelMode", "hideMenuTree",

View file

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

View file

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

View file

@ -63,6 +63,7 @@ public class WindowsTabbedPaneUI extends BasicTabbedPaneUI {
private boolean contentOpaque = true;
@SuppressWarnings("deprecation")
protected void installDefaults() {
super.installDefaults();
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.
*
* @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) {
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
* it public and it needs to be called from java.awt.
*/
@SuppressWarnings("deprecation")
Event convertToOld() {
Object src = getSource();
int newid = id;

View file

@ -350,6 +350,7 @@ public class AWTKeyStroke implements Serializable {
* @throws NullPointerException if {@code anEvent} is null
* @return the {@code AWTKeyStroke} that precipitated the event
*/
@SuppressWarnings("deprecation")
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent anEvent) {
int id = anEvent.getID();
switch(id) {
@ -397,6 +398,7 @@ public class AWTKeyStroke implements Serializable {
* @throws IllegalArgumentException if {@code s} is {@code null},
* or is formatted incorrectly
*/
@SuppressWarnings("deprecation")
public static AWTKeyStroke getAWTKeyStroke(String s) {
if (s == 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) {
if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
modifiers |= InputEvent.SHIFT_DOWN_MASK;
@ -737,6 +740,7 @@ public class AWTKeyStroke implements Serializable {
return modifiers;
}
@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) {
if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
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
*/
@SuppressWarnings("deprecation")
boolean dispatchMouseWheelToAncestor(MouseWheelEvent e) {
int newX, newY;
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
* track enter/exit regardless of where a drag originated
*/
@SuppressWarnings("deprecation")
public void eventDispatched(AWTEvent e) {
boolean isForeignDrag = (e instanceof MouseEvent) &&
!(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
* message.
*/
@SuppressWarnings("deprecation")
void retargetMouseEvent(Component target, int id, MouseEvent e) {
if (target == null) {
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.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,8 +24,7 @@
*/
package java.awt;
import java.awt.event.*;
import java.io.*;
import java.awt.event.KeyEvent;
/**
* <b>NOTE:</b> The {@code Event} class is obsolete and is
@ -56,9 +55,12 @@ import java.io.*;
* {@code Event} class ({@code PGUP},
* {@code PGDN}, {@code F1}, {@code F2}, etc).
*
* @deprecated It is recommended that {@code AWTEvent} and its subclasses be
* used instead
* @author Sami Shaio
* @since 1.0
*/
@Deprecated(since = "9")
public class Event implements java.io.Serializable {
private transient long data;

View file

@ -415,6 +415,7 @@ public abstract class KeyboardFocusManager
* Initializes a KeyboardFocusManager.
*/
public KeyboardFocusManager() {
@SuppressWarnings("deprecation")
AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
{
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
* keyboard event.
*/
@SuppressWarnings("deprecation")
boolean handleShortcut(KeyEvent e) {
// Is it a key event?
int id = e.getID();

View file

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

View file

@ -435,6 +435,7 @@ public class MenuItem extends MenuComponent implements Accessible {
* keydown) and the item is enabled.
* Returns true if there is an associated shortcut.
*/
@SuppressWarnings("deprecation")
boolean handleShortcut(KeyEvent e) {
MenuShortcut s = new MenuShortcut(e.getKeyCode(),
(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.
* @since 1.1
*/
@SuppressWarnings("deprecation")
public String toString() {
int modifiers = 0;
if (!GraphicsEnvironment.isHeadless()) {

View file

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

View file

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

View file

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

View file

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

View file

@ -26,7 +26,6 @@
package java.awt.event;
import java.awt.AWTEvent;
import java.awt.Event;
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
* 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
* 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
* 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
* 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
*/
@SuppressWarnings("deprecation")
public String paramString() {
String typeStr;
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.
*
* 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.
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
@ -159,7 +184,7 @@ public abstract class InputEvent extends ComponentEvent {
/**
* An array of extended modifiers for additional buttons.
* @see getButtonDownMasks
* @see #getButtonDownMasks()
* There are twenty buttons fit into 4byte space.
* one more bit is reserved for FIRST_HIGH_BIT.
* @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
*/
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
*/
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
*/
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
*/
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
*/
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.
*
* @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() {
return modifiers & (JDK_1_3_MODIFIERS | HIGH_MODIFIERS);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1235,6 +1235,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*
* @see EventListenerList
*/
@SuppressWarnings("deprecation")
protected void fireActionEvent() {
if (!firingActionEvent) {
// 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
* is managing focus for forward focus traversal.
*/
@SuppressWarnings("deprecation")
static Set<KeyStroke> getManagingFocusForwardTraversalKeys() {
synchronized(JComponent.class) {
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
* is managing focus for backward focus traversal.
*/
@SuppressWarnings("deprecation")
static Set<KeyStroke> getManagingFocusBackwardTraversalKeys() {
synchronized(JComponent.class) {
if (managingFocusBackwardTraversalKeys == null) {
@ -2886,6 +2888,7 @@ public abstract class JComponent extends Container implements Serializable,
*
* @since 1.3
*/
@SuppressWarnings("deprecation")
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,
int condition, boolean pressed) {
InputMap map = getInputMap(condition, false);

View file

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

View file

@ -1516,6 +1516,7 @@ public class JList<E> extends JComponent implements Scrollable, Accessible
* @see JComponent#setToolTipText
* @see JComponent#getToolTipText
*/
@SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) {
if(event != null) {
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 manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
processMenuDragMouseEvent(
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 manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
if (DEBUG) {
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 manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e, MenuElement path[],
MenuSelectionManager manager) {
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
Rectangle cellRect = getCellRect(hitRowIndex, hitColumnIndex, false);
p.translate(-cellRect.x, -cellRect.y);
@SuppressWarnings("deprecation")
final int modifiers = event.getModifiers();
MouseEvent newEvent = new MouseEvent(component, event.getID(),
event.getWhen(), event.getModifiers(),
event.getWhen(), modifiers,
p.x, p.y,
event.getXOnScreen(),
event.getYOnScreen(),

View file

@ -485,6 +485,7 @@ public class JTextField extends JTextComponent implements SwingConstants {
* first order.
* @see EventListenerList
*/
@SuppressWarnings("deprecation")
protected void fireActionPerformed() {
// Guaranteed to return a non-null array
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.
*/
@SuppressWarnings("deprecation")
public void setPressed(boolean b) {
if ((isPressed() == b) || !isEnabled()) {
return;

View file

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

View file

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

View file

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

View file

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

View file

@ -89,6 +89,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
*/
protected boolean heavyWeightPopupEnabled = false;
@SuppressWarnings("deprecation")
ToolTipManager() {
enterTimer = new Timer(750, new insideTimerAction());
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
// dispatches it to JComboBox.selectWithKeyChar() so that it can do
// type-ahead.
@SuppressWarnings("deprecation")
public void keyPressed( KeyEvent e ) {
if ( isNavigationKey(e.getKeyCode(), e.getModifiers()) ) {
lastTime = 0L;

View file

@ -528,6 +528,7 @@ public class BasicComboPopup extends JPopupMenu implements ComboPopup {
*/
protected JList<Object> createList() {
return new JList<Object>( comboBox.getModel() ) {
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e) {
if (BasicGraphicsUtils.isMenuShortcutKeyDown(e)) {
// 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 ) {
Point convertedPoint = SwingUtilities.convertPoint( (Component)e.getSource(),
e.getPoint(), list );
@SuppressWarnings("deprecation")
MouseEvent newEvent = new MouseEvent( (Component)e.getSource(),
e.getID(),
e.getWhen(),

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -868,6 +868,7 @@ public class BasicTableUI extends TableUI
public void keyReleased(KeyEvent e) { }
@SuppressWarnings("deprecation")
public void keyTyped(KeyEvent e) {
KeyStroke keyStroke = KeyStroke.getKeyStroke(e.getKeyChar(),
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
* editor is non editable
*/
@SuppressWarnings("deprecation")
void updateFocusTraversalKeys() {
/*
* Fix for 4514331 Non-editable JTextArea and similar

View file

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

View file

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

View file

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

View file

@ -384,6 +384,7 @@ public class JTableHeader extends JComponent implements TableColumnModelListener
* renderer and, therefore, the proper tip
* @return the tool tip for this component
*/
@SuppressWarnings("deprecation")
public String getToolTipText(MouseEvent event) {
String tip = null;
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
*/
@SuppressWarnings("deprecation")
private void selectWord(MouseEvent e) {
if (selectedWordEvent != null
&& selectedWordEvent.getX() == e.getX()
@ -405,6 +406,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
* @param e the mouse event
* @see MouseListener#mouseClicked
*/
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent e) {
if (getComponent() == null) {
return;
@ -513,6 +515,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
/**
* Adjusts the caret location based on the MouseEvent.
*/
@SuppressWarnings("deprecation")
private void adjustCaret(MouseEvent e) {
if ((e.getModifiers() & ActionEvent.SHIFT_MASK) != 0 &&
getDot() != -1) {

View file

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

View file

@ -126,6 +126,7 @@ public class NullComponentPeer implements LightweightPeer,
public void coalescePaintEvent(PaintEvent e) {
}
@SuppressWarnings("deprecation")
public boolean handleEvent(Event e) {
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.
*/
@SuppressWarnings("deprecation")
public int getFocusAcceleratorKeyMask() {
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
* characters from the extended character set (like euro sign or math symbols)
*/
@SuppressWarnings("deprecation")
public boolean isPrintableCharacterModifiersMask(int mods) {
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 MouseListener doubleClickListener;
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent evt) {
JComponent source = (JComponent)evt.getSource();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -477,6 +477,7 @@ public class XTrayIconPeer implements TrayIconPeer,
e.setSource(xtiPeer.target);
XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), e);
}
@SuppressWarnings("deprecation")
public void mouseClicked(MouseEvent e) {
if ((e.getClickCount() == 1 || xtiPeer.balloon.isVisible()) &&
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
return button == XConstants.buttons[3] || button == XConstants.buttons[4];
}
@SuppressWarnings("deprecation")
static int getXModifiers(AWTKeyStroke stroke) {
int mods = stroke.getModifiers();
int res = 0;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -124,7 +124,9 @@ public class VMPanel extends JTabbedPane implements PropertyChangeListener {
addMouseListener(new MouseAdapter() {
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()) {
userDisconnected = true;

View file

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