United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4761790 java.awt.event.MouseEvent: ambiguous Ctor
JDK-4761790 : java.awt.event.MouseEvent: ambiguous Ctor

Details
Type:
Bug
Submit Date:
2002-10-11
Status:
Closed
Updated Date:
2004-09-15
Project Name:
JDK
Resolved Date:
2004-09-15
Component:
docs
OS:
solaris_7,generic
Sub-Component:
guides
CPU:
sparc,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.0,5.0
Fixed Versions:
5.0 (tiger)

Related Reports

Sub Tasks

Description
Name: sdR10048			Date: 10/11/2002


JDK1.4 doc for
public java.awt.event.MouseEvent(Component source, int id,
                                 long when, int modifiers,
                                 int x, int y, int clickCount,
                                 boolean popupTrigger, int button)
says:

> Constructs a MouseEvent object with the specified source component, ty
> pe, modifiers, coordinates, and click count.
>
> Note that passing in an invalid id results in unspecified behavior.
>
> Parameters:
> source - the Component that originated the event
> id - the integer that identifies the event
> when - a long int that gives the time the event occurred
> modifiers - the modifier keys down during event (e.g. shift, ctrl,
> alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be
> used, but both models should not be mixed in one event. Use of the
> extended modifiers is preferred.
> x - the horizontal x coordinate for the mouse location
> y - the vertical y coordinate for the mouse location
> clickCount - the number of mouse clicks associated with event
> popupTrigger - a boolean, true if this event is a trigger for a popup
> menu
> button - which of the mouse buttons has changed state. NOBUTTON,
> BUTTON1, BUTTON2 or BUTTON3.
> Throws:
> IllegalArgumentException - if if an invalid button value is passed in.
It is not clear what if say 'modifiers' == MouseEvent.BUTTON1_MASK and
'button' == MouseEvent.BUTTON2. What getButton() will return.
Currently JDK returns what has been specified by 'modifiers'.
And point # 2: what is the right behavior here if 'modifiers' ==
MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON3_MASK?

See small demo about it:

import java.awt.event.*;
import java.awt.*;

class Test {
    public static void main(String args[]) {
        MouseEvent event =
            new MouseEvent(new Container(),
                           MouseEvent.MOUSE_CLICKED,
                           0,
                           MouseEvent.BUTTON1_MASK,       // button # 1
                           0, 0, 0, true,
                           MouseEvent.BUTTON2);           // button # 2
        System.out.println("button: "+event.getButton()); // button # ?
    }
}

Demo output:

] ~/tmp
] java Test
button: 1

Need for jck test development.
======================================================================
###@###.### 2004-09-15

                                    

Comments
EVALUATION

Reviewed by Brent.  Approved by CCC.  Fixed for tiger.
###@###.### 2003-08-18
                                     
2003-08-18
PUBLIC COMMENTS

.
                                     
2004-09-17
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
generic
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b19

VERIFIED IN:
1.5


                                     
2004-09-17



Hardware and Software, Engineered to Work Together