public MouseEvent (Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger, int button)

Constructs a MouseEvent object with the specified source component, type, time, modifiers, coordinates, click count, popupTrigger flag, and button number.

Creating an invalid event (such as by using more than one of the old _MASKs, or modifier/button values which don't match) results in unspecified behavior. An invocation of the form MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button) behaves in exactly the same way as the invocation MouseEvent(source, id, when, modifiers, x, y, xAbs, yAbs, clickCount, popupTrigger, button) where xAbs and yAbs defines as source's location on screen plus relative coordinates x and y. xAbs and yAbs are set to zero if the source is not showing. This method throws an IllegalArgumentException if source is null.

Parameters:
source    The Component that originated the event
id    An integer indicating the type of event. For information on allowable values, see the class description for MouseEvent
when    A long integer that gives the time the event occurred. Passing negative or zero value is not recommended
modifiers    a modifier mask describing the modifier keys and mouse buttons (for example, shift, ctrl, alt, and meta) that are down during the event. Only extended modifiers are allowed to be used as a value for this parameter (see the InputEvent.getModifiersEx class for the description of extended modifiers). Passing negative parameter is not recommended. Zero value means that no modifiers were passed
x    The horizontal x coordinate for the mouse location. It is allowed to pass negative values
y    The vertical y coordinate for the mouse location. It is allowed to pass negative values
clickCount    The number of mouse clicks associated with event. Passing negative value is not recommended
popupTrigger    A boolean that equals true if this event is a trigger for a popup menu
button    An integer that indicates, which of the mouse buttons has changed its state. The following rules are applied to this parameter:
  • If support for the extended mouse buttons is disabled by Java then it is allowed to create MouseEvent objects only with the standard buttons: NOBUTTON, BUTTON1, BUTTON2, and BUTTON3.
  • If support for the extended mouse buttons is enabled by Java then it is allowed to create MouseEvent objects with the standard buttons. In case the support for extended mouse buttons is enabled by Java, then in addition to the standard buttons, MouseEvent objects can be created using buttons from the range starting from 4 to MouseInfo.getNumberOfButtons() if the mouse has more than three buttons.

Exceptions:
IllegalArgumentException    if button is less then zero
IllegalArgumentException    if source is null
IllegalArgumentException    if button is greater then BUTTON3 and the support for extended mouse buttons is disabled by Java
IllegalArgumentException    if button is greater then the current number of buttons and the support for extended mouse buttons is enabled by Java
IllegalArgumentException    if an invalid button value is passed in
IllegalArgumentException    if source is null

See also:
getSource(), getID(), getWhen(), getModifiers(), getX(), getY(), getClickCount(), isPopupTrigger(), getButton()

Since:  1.4