JDK-4387938 : Unable to tell which button is pressed/released on a mouse event
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.8,1.3.0,1.4.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_7
  • CPU: generic,sparc
  • Submitted: 2000-11-10
  • Updated: 2001-01-23
  • Resolved: 2001-01-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
Other
1.4.0 betaFixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
The old InputEvent modifiers have same values for keyboard
and mouse buttons. So in certain situations there is no way
to distinguish which one is pressed or when more than one is held
simultanously.  These situations would include the cases when more 
than one mouse button is down at the same time, or when a 
modifier key is used to modify a mouse event.  



ingrid.yao@Eng 2001-05-10

CAP program member complains the new InputEvent modifiers are 
likely to cause many programs to fail since many programmers 
probably do something like:

[...]
if (e.getModifiers() == InputEvent.BUTTON1_MASK)
{
}
[...]

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin FIXED IN: merlin INTEGRATED IN: merlin-beta
2004-06-14

SUGGESTED FIX Problem: The old InputEvent modifiers have same values for keyboard and mouse buttons. So in certain situations there is no way to distinguish which one is pressed or when more than one is held simultanously. These situations would include the cases when more than one mouse button is down at the same time, or when a modifier key is used to modify a mouse event. For feature changes, RFE number from Bugtraq (required; bug must be at least in the evaluated state for this request to be approved, and must contain all pertinant information relating to the request and implementation): [This one] See also 4312913, 4350717, 4353201 Requestors (Must include team responsible for code which will be changed and any major customers): AWT Core (Sergey Salishev) Proposed API change: In InputEvent.java: Add new public constants /** * The SHIFT key down modifier constant. */ public static final int SHIFT_DOWN_MASK = 1 << 6; /** * The CTRL key down modifier constant. */ public static final int CTRL_DOWN_MASK = 1 << 7; /** * The META key down modifier constant. */ public static final int META_DOWN_MASK = 1 << 8; /** * The ALT key down modifier constant. */ public static final int ALT_DOWN_MASK = 1 << 9; /** * The mouse button1 down modifier constant. */ public static final int BUTTON1_DOWN_MASK = 1 << 10; /** * The mouse button2 down modifier constant. */ public static final int BUTTON2_DOWN_MASK = 1 << 11; /** * The mouse button3 down modifier constant. */ public static final int BUTTON3_DOWN_MASK = 1 << 12; /** * The mouse button1 changed modifier constant. */ public static final int BUTTON1_CHANGED_MASK = 1 << 13; /** * The mouse button2 changed modifier constant. */ public static final int BUTTON2_CHANGED_MASK = 1 << 14; /** * The mouse button3 changed modifier constant. */ public static final int BUTTON3_CHANGED_MASK = 1 << 15; Add new methods for checking mouse button is pressed. /* * Returns whether or not the Button1 modifier is down on this event. */ public boolean isButton1Down() /* * Returns whether or not the Button2 modifier is down on this event. */ public boolean isButton2Down() /* * Returns whether or not the Button3 modifier is down on this event. */ public boolean isButton3Down() In MouseEvent.java Add new public constants /** * No button has changed state */ public static final int NOBUTTON = 0; /** * Button1 has changed state */ public static final int BUTTON1 = 1; /** * Button2 has changed state */ public static final int BUTTON2 = 2; /** * Button3 has changed state */ public static final int BUTTON3 = 3; Add new method to check which mouse button is changed state. /** * Returns which one of the mouse buttons have changed state. * * @returns one of the following constants: * <code>NOBUTTON</code>, * <code>BUTTON1</code>, * <code>BUTTON2</code> and * <code>BUTTON3</code>. */ public int getButton() API reviewed by: Brent Christian Implementation: Name of engineer who made the changes: Sergey Salishev (###@###.###) Name of person who reviewed the changes: Brent Christian (Brent.Christian@eng) Date at which they will be integrated: November 28, 2000. # lines of new or modified code: native: 50 java : approx 5 Code reviewed (or will be reviewed) by: Brent Christian Risk assessment (required): Low. Minimal changes in current behaviour. Contact the test or docs team for input on the following info*: Javadoc will update the appropriate class documentation automatically SQE (product testing) impact: Name of test engineer committed to add/modify tests: TBD Date at which tests will be finalized: JCK (compatibility testing) impact: Name of person committed to write JCK tests: TBD Date at which tests will be finalized: Name of JCK group who has ok'ed the changes: Doc impact (contact Alan Sommerer if you don't know your contact): Name of person committed to add/modify documents: Sharon Zakhour Date by which docs will be finalized: Localization impact: Yes/No No. Internationalization impact: Yes/No No. Security impact: Yes/No No. Legal impact: Yes/No No. For feature changes, product marketing approval: N/A
2004-06-11

EVALUATION Commit to fix in Merlin. eric.hawkes@eng 2000-11-09
2000-11-09