2362N/A * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * An event which indicates that a mouse action occurred in a component. 0N/A * A mouse action is considered to occur in a particular component if and only 0N/A * if the mouse cursor is over the unobscured part of the component's bounds 0N/A * when the action happens. 0N/A * For lightweight components, such as Swing's components, mouse events 0N/A * are only dispatched to the component if the mouse event type has been 0N/A * enabled on the component. A mouse event type is enabled by adding the 0N/A * appropriate mouse-based {@code EventListener} to the component 0N/A * ({@link MouseListener} or {@link MouseMotionListener}), or by invoking 0N/A * {@link Component#enableEvents(long)} with the appropriate mask parameter 0N/A * ({@code AWTEvent.MOUSE_EVENT_MASK} or {@code AWTEvent.MOUSE_MOTION_EVENT_MASK}). 0N/A * If the mouse event type has not been enabled on the component, the 0N/A * corresponding mouse events are dispatched to the first ancestor that 0N/A * has enabled the mouse event type. 0N/A * For example, if a {@code MouseListener} has been added to a component, or 0N/A * {@code enableEvents(AWTEvent.MOUSE_EVENT_MASK)} has been invoked, then all 0N/A * the events defined by {@code MouseListener} are dispatched to the component. 0N/A * On the other hand, if a {@code MouseMotionListener} has not been added and 0N/A * {@code enableEvents} has not been invoked with 0N/A * {@code AWTEvent.MOUSE_MOTION_EVENT_MASK}, then mouse motion events are not 0N/A * dispatched to the component. Instead the mouse motion events are 0N/A * dispatched to the first ancestors that has enabled mouse motion 0N/A * This low-level event is generated by a component object for: 0N/A * <li>a mouse button is pressed 0N/A * <li>a mouse button is released 0N/A * <li>a mouse button is clicked (pressed and released) 0N/A * <li>the mouse cursor enters the unobscured part of component's geometry 0N/A * <li>the mouse cursor exits the unobscured part of component's geometry 0N/A * <li> Mouse Motion Events 0N/A * <li>the mouse is moved 0N/A * <li>the mouse is dragged 0N/A * A <code>MouseEvent</code> object is passed to every 0N/A * <code>MouseListener</code> 0N/A * or <code>MouseAdapter</code> object which is registered to receive 0N/A * the "interesting" mouse events using the component's 0N/A * <code>addMouseListener</code> method. 0N/A * (<code>MouseAdapter</code> objects implement the 0N/A * <code>MouseListener</code> interface.) Each such listener object 0N/A * gets a <code>MouseEvent</code> containing the mouse event. 0N/A * A <code>MouseEvent</code> object is also passed to every 0N/A * <code>MouseMotionListener</code> or 0N/A * <code>MouseMotionAdapter</code> object which is registered to receive 0N/A * mouse motion events using the component's 0N/A * <code>addMouseMotionListener</code> 0N/A * method. (<code>MouseMotionAdapter</code> objects implement the 0N/A * <code>MouseMotionListener</code> interface.) Each such listener object 0N/A * gets a <code>MouseEvent</code> containing the mouse motion event. 0N/A * When a mouse button is clicked, events are generated and sent to the 0N/A * registered <code>MouseListener</code>s. 0N/A * The state of modal keys can be retrieved using {@link InputEvent#getModifiers} 0N/A * and {@link InputEvent#getModifiersEx}. 0N/A * The button mask returned by {@link InputEvent#getModifiers} reflects 0N/A * only the button that changed state, not the current state of all buttons. 0N/A * To get the state of all buttons and modifier keys, use 0N/A * {@link InputEvent#getModifiersEx}. 0N/A * The button which has changed state is returned by {@link MouseEvent#getButton} 0N/A * For example, if the first mouse button is pressed, events are sent in the 0N/A * <b >id </b > <b >modifiers </b > <b >button </b > 0N/A * <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * When multiple mouse buttons are pressed, each press, release, and click 0N/A * results in a separate event. 0N/A * For example, if the user presses <b>button 1</b> followed by 0N/A * <b>button 2</b>, and then releases them in the same order, 0N/A * the following sequence of events is generated: 0N/A * <b >id </b > <b >modifiers </b > <b >button </b > 0N/A * <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * <code>MOUSE_PRESSED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code> 0N/A * <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code> 0N/A * <code>MOUSE_RELEASED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code> 0N/A * <code>MOUSE_CLICKED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code> 0N/A * If <b>button 2</b> is released first, the 0N/A * <code>MOUSE_RELEASED</code>/<code>MOUSE_CLICKED</code> pair 0N/A * for <code>BUTTON2_MASK</code> arrives first, 0N/A * followed by the pair for <code>BUTTON1_MASK</code>. 870N/A * Some extra mouse buttons are added to extend the standard set of buttons 870N/A * represented by the following constants:{@code BUTTON1}, {@code BUTTON2}, and {@code BUTTON3}. 870N/A * Extra buttons have no assigned {@code BUTTONx} 870N/A * constants as well as their button masks have no assigned {@code BUTTONx_DOWN_MASK} 870N/A * constants. Nevertheless, ordinal numbers starting from 4 may be 870N/A * used as button numbers (button ids). Values obtained by the 870N/A * {@link InputEvent#getMaskForButton(int) getMaskForButton(button)} method may be used 0N/A * <code>MOUSE_DRAGGED</code> events are delivered to the <code>Component</code> 0N/A * in which the mouse button was pressed until the mouse button is released 0N/A * (regardless of whether the mouse position is within the bounds of the 0N/A * <code>Component</code>). Due to platform-dependent Drag&Drop implementations, 0N/A * <code>MOUSE_DRAGGED</code> events may not be delivered during a native 0N/A * Drag&Drop operation. 0N/A * In a multi-screen environment mouse drag events are delivered to the 0N/A * <code>Component</code> even if the mouse position is outside the bounds of the 0N/A * <code>GraphicsConfiguration</code> associated with that 0N/A * <code>Component</code>. However, the reported position for mouse drag events 0N/A * in this case may differ from the actual mouse position: 0N/A * <li>In a multi-screen environment without a virtual device: 0N/A * The reported coordinates for mouse drag events are clipped to fit within the 0N/A * bounds of the <code>GraphicsConfiguration</code> associated with 0N/A * the <code>Component</code>. 0N/A * <li>In a multi-screen environment with a virtual device: 0N/A * The reported coordinates for mouse drag events are clipped to fit within the 0N/A * bounds of the virtual device associated with the <code>Component</code>. 217N/A * An unspecified behavior will be caused if the {@code id} parameter 217N/A * of any particular {@code MouseEvent} instance is not 217N/A * in the range from {@code MOUSE_FIRST} to {@code MOUSE_LAST}-1 217N/A * ({@code MOUSE_WHEEL} is not acceptable). 0N/A * @author Carl Quinn 0N/A * @see MouseListener 0N/A * @see MouseMotionAdapter 0N/A * @see MouseMotionListener 0N/A * @see MouseWheelListener 0N/A * The first number in the range of ids used for mouse events. 0N/A * The last number in the range of ids used for mouse events. 0N/A * The "mouse clicked" event. This <code>MouseEvent</code> 0N/A * occurs when a mouse button is pressed and released. 0N/A * The "mouse pressed" event. This <code>MouseEvent</code> 0N/A * occurs when a mouse button is pushed down. 0N/A * The "mouse released" event. This <code>MouseEvent</code> 0N/A * occurs when a mouse button is let up. 0N/A * The "mouse moved" event. This <code>MouseEvent</code> 0N/A * occurs when the mouse position changes. 0N/A * The "mouse entered" event. This <code>MouseEvent</code> 0N/A * occurs when the mouse cursor enters the unobscured part of component's 0N/A * The "mouse exited" event. This <code>MouseEvent</code> 0N/A * occurs when the mouse cursor exits the unobscured part of component's 0N/A * The "mouse dragged" event. This <code>MouseEvent</code> 0N/A * occurs when the mouse position changes while a mouse button is pressed. 0N/A * The "mouse wheel" event. This is the only <code>MouseWheelEvent</code>. 0N/A * It occurs when a mouse equipped with a wheel has its wheel rotated. 0N/A * Indicates no mouse buttons; used by {@link #getButton}. 0N/A * Indicates mouse button #1; used by {@link #getButton}. 0N/A * Indicates mouse button #2; used by {@link #getButton}. 0N/A * Indicates mouse button #3; used by {@link #getButton}. 0N/A * The mouse event's x coordinate. 0N/A * The x value is relative to the component that fired the event. 0N/A * The mouse event's y coordinate. 0N/A * The y value is relative to the component that fired the event. 0N/A * The mouse event's x absolute coordinate. 0N/A * In a virtual device multi-screen environment in which the 0N/A * desktop area could span multiple physical screen devices, 0N/A * this coordinate is relative to the virtual coordinate system. 0N/A * Otherwise, this coordinate is relative to the coordinate system 0N/A * associated with the Component's GraphicsConfiguration. 0N/A * The mouse event's y absolute coordinate. 0N/A * In a virtual device multi-screen environment in which the 0N/A * desktop area could span multiple physical screen devices, 0N/A * this coordinate is relative to the virtual coordinate system. 0N/A * Otherwise, this coordinate is relative to the coordinate system 0N/A * associated with the Component's GraphicsConfiguration. 0N/A * Indicates the number of quick consecutive clicks of 0N/A * clickCount will be valid for only three mouse events :<BR> 0N/A * <code>MOUSE_CLICKED</code>, 0N/A * <code>MOUSE_PRESSED</code> and 0N/A * <code>MOUSE_RELEASED</code>. 0N/A * For the above, the <code>clickCount</code> will be at least 1. 0N/A * For all other events the count will be 0. 0N/A * @see #getClickCount(). 0N/A * Indicates which, if any, of the mouse buttons has changed state. 870N/A * The valid values are ranged from 0 to the value returned by the 870N/A * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()} method. 870N/A * This range already includes constants {@code NOBUTTON}, {@code BUTTON1}, 870N/A * {@code BUTTON2}, and {@code BUTTON3} 870N/A * if these buttons are present. So it is allowed to use these constants too. 870N/A * For example, for a mouse with two buttons this field may contain the following values: 870N/A * <li> 0 ({@code NOBUTTON}) 870N/A * <li> 1 ({@code BUTTON1}) 870N/A * <li> 2 ({@code BUTTON2}) 870N/A * If a mouse has 5 buttons, this field may contain the following values: 870N/A * <li> 0 ({@code NOBUTTON}) 870N/A * <li> 1 ({@code BUTTON1}) 870N/A * <li> 2 ({@code BUTTON2}) 870N/A * <li> 3 ({@code BUTTON3}) 870N/A * If support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled()} disabled by Java 870N/A * then the field may not contain the value larger than {@code BUTTON3}. 870N/A * @see java.awt.Toolkit#areExtraMouseButtonsEnabled() 0N/A * A property used to indicate whether a Popup Menu 0N/A * should appear with a certain gestures. 0N/A * If <code>popupTrigger</code> = <code>false</code>, 0N/A * no popup menu should appear. If it is <code>true</code> 0N/A * then a popup menu should appear. 0N/A * @see java.awt.PopupMenu 0N/A * @see #isPopupTrigger() 0N/A * JDK 1.1 serialVersionUID 1224N/A * A number of buttons available on the mouse at the {@code Toolkit} machinery startup. 0N/A /* ensure that the necessary native libraries are loaded */ 1224N/A //It's expected that some toolkits (Headless, 1224N/A //whatever besides SunToolkit) could also operate. 0N/A * Initialize JNI field and method IDs for fields that may be 0N/A * Returns the absolute x, y position of the event. 0N/A * In a virtual device multi-screen environment in which the 0N/A * desktop area could span multiple physical screen devices, 0N/A * these coordinates are relative to the virtual coordinate system. 0N/A * Otherwise, these coordinates are relative to the coordinate system 0N/A * associated with the Component's GraphicsConfiguration. 0N/A * @return a <code>Point</code> object containing the absolute x 0N/A * and y coordinates. 0N/A * @see java.awt.GraphicsConfiguration 0N/A * Returns the absolute horizontal x position of the event. 0N/A * In a virtual device multi-screen environment in which the 0N/A * desktop area could span multiple physical screen devices, 0N/A * this coordinate is relative to the virtual coordinate system. 0N/A * Otherwise, this coordinate is relative to the coordinate system 0N/A * associated with the Component's GraphicsConfiguration. 0N/A * @return x an integer indicating absolute horizontal position. 0N/A * @see java.awt.GraphicsConfiguration 0N/A * Returns the absolute vertical y position of the event. 0N/A * In a virtual device multi-screen environment in which the 0N/A * desktop area could span multiple physical screen devices, 0N/A * this coordinate is relative to the virtual coordinate system. 0N/A * Otherwise, this coordinate is relative to the coordinate system 0N/A * associated with the Component's GraphicsConfiguration. 0N/A * @return y an integer indicating absolute vertical position. 0N/A * @see java.awt.GraphicsConfiguration 0N/A * Constructs a <code>MouseEvent</code> object with the 0N/A * specified source component, 870N/A * type, time, modifiers, coordinates, click count, popupTrigger flag, 217N/A * Creating an invalid event (such 0N/A * values which don't match) results in unspecified behavior. 0N/A * An invocation of the form 0N/A * <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt> {@link #MouseEvent(Component, int, long, int, int, int, 0N/A * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers, 0N/A * x, y, xAbs, yAbs, clickCount, popupTrigger, button)</tt> 0N/A * where xAbs and yAbs defines as source's location on screen plus 0N/A * relative coordinates x and y. 0N/A * xAbs and yAbs are set to zero if the source is not showing. 0N/A * This method throws an 0N/A * <code>IllegalArgumentException</code> if <code>source</code> 0N/A * is <code>null</code>. 217N/A * @param source The <code>Component</code> that originated the event 217N/A * @param id An integer indicating the type of event. 217N/A * For information on allowable values, see 217N/A * the class description for {@link MouseEvent} 217N/A * @param when A long integer that gives the time the event occurred. 217N/A * Passing negative or zero value 217N/A * @param modifiers The modifier keys down during event (e.g. shift, ctrl, 217N/A * Passing negative parameter 217N/A * Zero value means that no modifiers were passed. 217N/A * Use either an extended _DOWN_MASK or old _MASK modifiers, 217N/A * however do not mix models in the one event. 217N/A * The extended modifiers are preferred for using 217N/A * @param x The horizontal x coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param y The vertical y coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param clickCount The number of mouse clicks associated with event. 217N/A * Passing negative value 217N/A * @param popupTrigger A boolean that equals {@code true} if this event 217N/A * is a trigger for a popup menu 217N/A * @param button An integer that indicates, which of the mouse buttons has 870N/A * The following rules are applied to this parameter: 870N/A * <li>If support for the extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * then it is allowed to create {@code MouseEvent} objects only with the standard buttons: 870N/A * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and 870N/A * <li> If support for the extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java 870N/A * then it is allowed to create {@code MouseEvent} objects with 870N/A * the standard buttons. 870N/A * In case the support for extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then 870N/A * in addition to the standard buttons, {@code MouseEvent} objects can be created 870N/A * using buttons from the range starting from 4 to 870N/A * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()} 870N/A * if the mouse has more than three buttons. 870N/A * @throws IllegalArgumentException if {@code button} is less then zero 870N/A * @throws IllegalArgumentException if <code>source</code> is null 870N/A * @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * @throws IllegalArgumentException if {@code button} is greater then the 870N/A * {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support 870N/A * for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} 0N/A * @throws IllegalArgumentException if an invalid <code>button</code> 0N/A * value is passed in 0N/A * @throws IllegalArgumentException if <code>source</code> is null 217N/A * @see #getClickCount() 217N/A * @see #isPopupTrigger() 0N/A this(
source,
id,
when,
modifiers, x, y,
0,
0,
clickCount,
popupTrigger,
button);
0N/A * Constructs a <code>MouseEvent</code> object with the 0N/A * specified source component, 870N/A * type, modifiers, coordinates, click count, and popupTrigger flag. 0N/A * An invocation of the form 0N/A * <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)</tt> 0N/A * behaves in exactly the same way as the invocation 0N/A * <tt> {@link #MouseEvent(Component, int, long, int, int, int, 0N/A * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers, 0N/A * x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)</tt> 0N/A * where xAbs and yAbs defines as source's location on screen plus 0N/A * relative coordinates x and y. 0N/A * xAbs and yAbs are set to zero if the source is not showing. 0N/A * This method throws an <code>IllegalArgumentException</code> 0N/A * if <code>source</code> is <code>null</code>. 217N/A * @param source The <code>Component</code> that originated the event 217N/A * @param id An integer indicating the type of event. 217N/A * For information on allowable values, see 217N/A * the class description for {@link MouseEvent} 217N/A * @param when A long integer that gives the time the event occurred. 217N/A * Passing negative or zero value 217N/A * @param modifiers The modifier keys down during event (e.g. shift, ctrl, 217N/A * Passing negative parameter 217N/A * Zero value means that no modifiers were passed. 217N/A * Use either an extended _DOWN_MASK or old _MASK modifiers, 217N/A * however do not mix models in the one event. 217N/A * The extended modifiers are preferred for using 217N/A * @param x The horizontal x coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param y The vertical y coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param clickCount The number of mouse clicks associated with event. 217N/A * Passing negative value 217N/A * @param popupTrigger A boolean that equals {@code true} if this event 217N/A * is a trigger for a popup menu 0N/A * @throws IllegalArgumentException if <code>source</code> is null 217N/A * @see #getClickCount() 217N/A * @see #isPopupTrigger() 870N/A /* if the button is an extra button and it is released or clicked then in Xsystem its state 870N/A is not modified. Exclude this button number from ExtModifiers mask.*/ 0N/A * Constructs a <code>MouseEvent</code> object with the 0N/A * specified source component, 870N/A * type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag, 217N/A * Creating an invalid event (such 0N/A * values which don't match) results in unspecified behavior. 0N/A * Even if inconsistent values for relative and absolute coordinates are 0N/A * passed to the constructor, the mouse event instance is still 0N/A * created and no exception is thrown. 0N/A * This method throws an 0N/A * <code>IllegalArgumentException</code> if <code>source</code> 0N/A * is <code>null</code>. 217N/A * @param source The <code>Component</code> that originated the event 217N/A * @param id An integer indicating the type of event. 217N/A * For information on allowable values, see 217N/A * the class description for {@link MouseEvent} 217N/A * @param when A long integer that gives the time the event occurred. 217N/A * Passing negative or zero value 217N/A * @param modifiers The modifier keys down during event (e.g. shift, ctrl, 217N/A * Passing negative parameter 217N/A * Zero value means that no modifiers were passed. 217N/A * Use either an extended _DOWN_MASK or old _MASK modifiers, 217N/A * however do not mix models in the one event. 217N/A * The extended modifiers are preferred for using 217N/A * @param x The horizontal x coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param y The vertical y coordinate for the mouse location. 217N/A * It is allowed to pass negative values 217N/A * @param xAbs The absolute horizontal x coordinate for the mouse location 217N/A * It is allowed to pass negative values 217N/A * @param yAbs The absolute vertical y coordinate for the mouse location 217N/A * It is allowed to pass negative values 217N/A * @param clickCount The number of mouse clicks associated with event. 217N/A * Passing negative value 217N/A * @param popupTrigger A boolean that equals {@code true} if this event 217N/A * is a trigger for a popup menu 217N/A * @param button An integer that indicates, which of the mouse buttons has 870N/A * The following rules are applied to this parameter: 870N/A * <li>If support for the extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * then it is allowed to create {@code MouseEvent} objects only with the standard buttons: 870N/A * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and 870N/A * <li> If support for the extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java 870N/A * then it is allowed to create {@code MouseEvent} objects with 870N/A * the standard buttons. 870N/A * In case the support for extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then 870N/A * in addition to the standard buttons, {@code MouseEvent} objects can be created 870N/A * using buttons from the range starting from 4 to 870N/A * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()} 870N/A * if the mouse has more than three buttons. 870N/A * @throws IllegalArgumentException if {@code button} is less then zero 870N/A * @throws IllegalArgumentException if <code>source</code> is null 870N/A * @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is 870N/A * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * @throws IllegalArgumentException if {@code button} is greater then the 870N/A * {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support 870N/A * for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} 0N/A * @throws IllegalArgumentException if an invalid <code>button</code> 0N/A * value is passed in 0N/A * @throws IllegalArgumentException if <code>source</code> is null 217N/A * @see #getClickCount() 217N/A * @see #isPopupTrigger() 870N/A * @see Toolkit#areExtraMouseButtonsEnabled() 870N/A * @see java.awt.MouseInfo#getNumberOfButtons() 870N/A * @see InputEvent#getMaskForButton(int) 870N/A // XToolkit: extra buttons are not reporting about their state correctly. 870N/A // Being pressed they report the state=0 both on the press and on the release. 870N/A // For 1-3 buttons the state value equals zero on press and non-zero on release. 870N/A // Other modifiers like Shift, ALT etc seem report well with extra buttons. 870N/A // The problem reveals as follows: one button is pressed and then another button is pressed and released. 870N/A // So, the getModifiersEx() would not be zero due to a first button and we will skip this modifier. 870N/A // This may have to be moved into the peer code instead if possible. 0N/A * Returns the horizontal x position of the event relative to the 0N/A * @return x an integer indicating horizontal position relative to 0N/A * Returns the vertical y position of the event relative to the 0N/A * @return y an integer indicating vertical position relative to 0N/A * Returns the x,y position of the event relative to the source component. 0N/A * @return a <code>Point</code> object containing the x and y coordinates 0N/A * relative to the source component 0N/A synchronized (
this) {
0N/A * Translates the event's coordinates to a new position 0N/A * by adding specified <code>x</code> (horizontal) and <code>y</code> 0N/A * (vertical) offsets. 0N/A * @param x the horizontal x value to add to the current x 0N/A * coordinate position 0N/A * @param y the vertical y value to add to the current y 0N/A * Returns the number of mouse clicks associated with this event. 0N/A * @return integer value for the number of clicks 0N/A * Returns which, if any, of the mouse buttons has changed state. 870N/A * The returned value is ranged 870N/A * from 0 to the {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()} 870N/A * The returned value includes at least the following constants: 870N/A * <li> {@code NOBUTTON} 870N/A * It is allowed to use those constants to compare with the returned button number in the application. 870N/A * if (anEvent.getButton() == MouseEvent.BUTTON1) { 870N/A * In particular, for a mouse with one, two, or three buttons this method may return the following values: 870N/A * <li> 0 ({@code NOBUTTON}) 870N/A * <li> 1 ({@code BUTTON1}) 870N/A * <li> 2 ({@code BUTTON2}) 870N/A * <li> 3 ({@code BUTTON3}) 870N/A * Button numbers greater then {@code BUTTON3} have no constant identifier. So if a mouse with five buttons is 870N/A * installed, this method may return the following values: 870N/A * <li> 0 ({@code NOBUTTON}) 870N/A * <li> 1 ({@code BUTTON1}) 870N/A * <li> 2 ({@code BUTTON2}) 870N/A * <li> 3 ({@code BUTTON3}) 870N/A * Note: If support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * then the AWT event subsystem does not produce mouse events for the extended mouse 870N/A * buttons. So it is not expected that this method returns anything except {@code NOBUTTON}, {@code BUTTON1}, 870N/A * {@code BUTTON2}, {@code BUTTON3}. 870N/A * @return one of the values from 0 to {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()} 870N/A * if support for the extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java. 870N/A * That range includes {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, {@code BUTTON3}; 870N/A * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} or {@code BUTTON3} 870N/A * if support for the extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java 870N/A * @see Toolkit#areExtraMouseButtonsEnabled() 870N/A * @see java.awt.MouseInfo#getNumberOfButtons() 870N/A * @see #MouseEvent(Component, int, long, int, int, int, int, int, int, boolean, int) 870N/A * @see InputEvent#getMaskForButton(int) 0N/A * Returns whether or not this mouse event is the popup menu 0N/A * trigger event for the platform. 0N/A * <p><b>Note</b>: Popup menus are triggered differently 0N/A * on different systems. Therefore, <code>isPopupTrigger</code> 0N/A * should be checked in both <code>mousePressed</code> 0N/A * and <code>mouseReleased</code> 0N/A * for proper cross-platform functionality. 0N/A * @return boolean, true if this event is the popup menu trigger 217N/A * Returns a <code>String</code> instance describing the modifier keys and 0N/A * mouse buttons that were down during the event, such as "Shift", 0N/A * or "Ctrl+Shift". These strings can be localized by changing 217N/A * Note that the <code>InputEvent.ALT_MASK</code> and 217N/A * <code>InputEvent.BUTTON2_MASK</code> have equal values, 217N/A * so the "Alt" string is returned for both modifiers. Likewise, 217N/A * the <code>InputEvent.META_MASK</code> and 217N/A * <code>InputEvent.BUTTON3_MASK</code> have equal values, 217N/A * so the "Meta" string is returned for both modifiers. 217N/A * Note that passing negative parameter is incorrect, 217N/A * and will cause the returning an unspecified string. 217N/A * Zero parameter means that no modifiers were passed and will 217N/A * cause the returning an empty string. 217N/A * @param modifiers A modifier mask describing the modifier keys and 0N/A * mouse buttons that were down during the event 217N/A * @return string string text description of the combination of modifier 0N/A * keys and mouse buttons that were down during the event 0N/A * @see InputEvent#getModifiersExText(int) 870N/A // TODO: add a toolkit field that holds a number of button on the mouse. 870N/A // As the method getMouseModifiersText() is static and obtain 870N/A // an integer as a parameter then we may not restrict this with the number 870N/A // of buttons installed on the mouse. 870N/A // It's a temporary solution. We need to somehow hold the number of buttons somewhere else. 0N/A * Returns a parameter string identifying this event. 0N/A * This method is useful for event-logging and for debugging. 0N/A * @return a string identifying the event and its attributes 0N/A // (x,y) coordinates 870N/A //Using plain "modifiers" here does show an excluded extended buttons in the string event representation. 870N/A //getModifiersEx() solves the problem. 0N/A * Sets new modifiers by the old ones. 0N/A * Sets old modifiers by the new ones. 0N/A * Sets new modifiers by the old ones.