< prev index next >
src/java.desktop/share/classes/java/awt/event/InputEvent.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1996, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 60,114 ****
private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
/**
* The Shift key modifier constant.
! * It is recommended that SHIFT_DOWN_MASK be used instead.
*/
public static final int SHIFT_MASK = Event.SHIFT_MASK;
/**
* The Control key modifier constant.
! * It is recommended that CTRL_DOWN_MASK be used instead.
*/
public static final int CTRL_MASK = Event.CTRL_MASK;
/**
* The Meta key modifier constant.
! * It is recommended that META_DOWN_MASK be used instead.
*/
public static final int META_MASK = Event.META_MASK;
/**
* The Alt key modifier constant.
! * It is recommended that ALT_DOWN_MASK be used instead.
*/
public static final int ALT_MASK = Event.ALT_MASK;
/**
* The AltGraph key modifier constant.
*/
public static final int ALT_GRAPH_MASK = 1 << 5;
/**
* The Mouse Button1 modifier constant.
! * It is recommended that BUTTON1_DOWN_MASK be used instead.
*/
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.
*/
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.
*/
public static final int BUTTON3_MASK = Event.META_MASK;
/**
* The Shift key extended modifier constant.
* @since 1.4
--- 60,139 ----
private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
/**
* The Shift key modifier constant.
! *
! * @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.
! *
! * @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.
! *
! * @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.
! *
! * @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.
! *
! * @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.
! *
! * @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.
! *
! * @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;
/**
* The Shift key extended modifier constant.
* @since 1.4
*** 157,167 ****
*/
public static final int ALT_GRAPH_DOWN_MASK = 1 << 13;
/**
* An array of extended modifiers for additional buttons.
! * @see getButtonDownMasks
* There are twenty buttons fit into 4byte space.
* one more bit is reserved for FIRST_HIGH_BIT.
* @since 1.7
*/
private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK,
--- 182,192 ----
*/
public static final int ALT_GRAPH_DOWN_MASK = 1 << 13;
/**
* An array of extended modifiers for additional buttons.
! * @see #getButtonDownMasks()
* There are twenty buttons fit into 4byte space.
* one more bit is reserved for FIRST_HIGH_BIT.
* @since 1.7
*/
private static final int [] BUTTON_DOWN_MASK = new int [] { BUTTON1_DOWN_MASK,
*** 380,422 ****
/**
* Returns 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() {
! return (modifiers & SHIFT_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & CTRL_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & META_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & ALT_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & ALT_GRAPH_MASK) != 0;
}
/**
* Returns the difference in milliseconds between the timestamp of when this event occurred and
* midnight, January 1, 1970 UTC.
--- 405,447 ----
/**
* Returns 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() {
! return (modifiers & SHIFT_DOWN_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & CTRL_DOWN_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & META_DOWN_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & ALT_DOWN_MASK) != 0;
}
/**
* Returns 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() {
! return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
}
/**
* Returns the difference in milliseconds between the timestamp of when this event occurred and
* midnight, January 1, 1970 UTC.
*** 426,437 ****
--- 451,466 ----
return when;
}
/**
* 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);
}
/**
< prev index next >