< prev index next >
src/java.desktop/share/classes/java/awt/event/MouseEvent.java
Print this page
*** 76,105 ****
* <li>the mouse is moved
* <li>the mouse is dragged
* </ul>
* </ul>
* <P>
! * A <code>MouseEvent</code> object is passed to every
! * <code>MouseListener</code>
! * or <code>MouseAdapter</code> object which is registered to receive
* the "interesting" mouse events using the component's
! * <code>addMouseListener</code> method.
! * (<code>MouseAdapter</code> objects implement the
! * <code>MouseListener</code> interface.) Each such listener object
! * gets a <code>MouseEvent</code> containing the mouse event.
* <P>
! * A <code>MouseEvent</code> object is also passed to every
! * <code>MouseMotionListener</code> or
! * <code>MouseMotionAdapter</code> object which is registered to receive
* mouse motion events using the component's
! * <code>addMouseMotionListener</code>
! * method. (<code>MouseMotionAdapter</code> objects implement the
! * <code>MouseMotionListener</code> interface.) Each such listener object
! * gets a <code>MouseEvent</code> containing the mouse motion event.
* <P>
* When a mouse button is clicked, events are generated and sent to the
! * registered <code>MouseListener</code>s.
* The state of modal keys can be retrieved using {@link InputEvent#getModifiers}
* and {@link InputEvent#getModifiersEx}.
* The button mask returned by {@link InputEvent#getModifiers} reflects
* only the button that changed state, not the current state of all buttons.
* (Note: Due to overlap in the values of ALT_MASK/BUTTON2_MASK and
--- 76,105 ----
* <li>the mouse is moved
* <li>the mouse is dragged
* </ul>
* </ul>
* <P>
! * A {@code MouseEvent} object is passed to every
! * {@code MouseListener}
! * or {@code MouseAdapter} object which is registered to receive
* the "interesting" mouse events using the component's
! * {@code addMouseListener} method.
! * ({@code MouseAdapter} objects implement the
! * {@code MouseListener} interface.) Each such listener object
! * gets a {@code MouseEvent} containing the mouse event.
* <P>
! * A {@code MouseEvent} object is also passed to every
! * {@code MouseMotionListener} or
! * {@code MouseMotionAdapter} object which is registered to receive
* mouse motion events using the component's
! * {@code addMouseMotionListener}
! * method. ({@code MouseMotionAdapter} objects implement the
! * {@code MouseMotionListener} interface.) Each such listener object
! * gets a {@code MouseEvent} containing the mouse motion event.
* <P>
* When a mouse button is clicked, events are generated and sent to the
! * registered {@code MouseListener}s.
* The state of modal keys can be retrieved using {@link InputEvent#getModifiers}
* and {@link InputEvent#getModifiersEx}.
* The button mask returned by {@link InputEvent#getModifiers} reflects
* only the button that changed state, not the current state of all buttons.
* (Note: Due to overlap in the values of ALT_MASK/BUTTON2_MASK and
*** 109,143 ****
* {@link InputEvent#getModifiersEx}.
* The button which has changed state is returned by {@link MouseEvent#getButton}
* <P>
* For example, if the first mouse button is pressed, events are sent in the
* following order:
! * <PRE>
! * <b >id </b > <b >modifiers </b > <b >button </b >
! * <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * </PRE>
* When multiple mouse buttons are pressed, each press, release, and click
* results in a separate event.
* <P>
* For example, if the user presses <b>button 1</b> followed by
* <b>button 2</b>, and then releases them in the same order,
* the following sequence of events is generated:
! * <PRE>
! * <b >id </b > <b >modifiers </b > <b >button </b >
! * <code>MOUSE_PRESSED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * <code>MOUSE_PRESSED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
! * <code>MOUSE_RELEASED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * <code>MOUSE_CLICKED</code>: <code>BUTTON1_MASK</code> <code>BUTTON1</code>
! * <code>MOUSE_RELEASED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
! * <code>MOUSE_CLICKED</code>: <code>BUTTON2_MASK</code> <code>BUTTON2</code>
! * </PRE>
* If <b>button 2</b> is released first, the
! * <code>MOUSE_RELEASED</code>/<code>MOUSE_CLICKED</code> pair
! * for <code>BUTTON2_MASK</code> arrives first,
! * followed by the pair for <code>BUTTON1_MASK</code>.
* <p>
* Some extra mouse buttons are added to extend the standard set of buttons
* represented by the following constants:{@code BUTTON1}, {@code BUTTON2}, and {@code BUTTON3}.
* Extra buttons have no assigned {@code BUTTONx}
* constants as well as their button masks have no assigned {@code BUTTONx_DOWN_MASK}
--- 109,143 ----
* {@link InputEvent#getModifiersEx}.
* The button which has changed state is returned by {@link MouseEvent#getButton}
* <P>
* For example, if the first mouse button is pressed, events are sent in the
* following order:
! * <pre><b>
! * id modifiers button</b>{@code
! * MOUSE_PRESSED: BUTTON1_MASK BUTTON1
! * MOUSE_RELEASED: BUTTON1_MASK BUTTON1
! * MOUSE_CLICKED: BUTTON1_MASK BUTTON1
! * }</pre>
* When multiple mouse buttons are pressed, each press, release, and click
* results in a separate event.
* <P>
* For example, if the user presses <b>button 1</b> followed by
* <b>button 2</b>, and then releases them in the same order,
* the following sequence of events is generated:
! * <pre><b>
! * id modifiers button</b>{@code
! * MOUSE_PRESSED: BUTTON1_MASK BUTTON1
! * MOUSE_PRESSED: BUTTON2_MASK BUTTON2
! * MOUSE_RELEASED: BUTTON1_MASK BUTTON1
! * MOUSE_CLICKED: BUTTON1_MASK BUTTON1
! * MOUSE_RELEASED: BUTTON2_MASK BUTTON2
! * MOUSE_CLICKED: BUTTON2_MASK BUTTON2
! * }</pre>
* If <b>button 2</b> is released first, the
! * {@code MOUSE_RELEASED}/{@code MOUSE_CLICKED} pair
! * for {@code BUTTON2_MASK} arrives first,
! * followed by the pair for {@code BUTTON1_MASK}.
* <p>
* Some extra mouse buttons are added to extend the standard set of buttons
* represented by the following constants:{@code BUTTON1}, {@code BUTTON2}, and {@code BUTTON3}.
* Extra buttons have no assigned {@code BUTTONx}
* constants as well as their button masks have no assigned {@code BUTTONx_DOWN_MASK}
*** 152,175 ****
* {@code Component}). Due to platform-dependent Drag&Drop implementations,
* {@code MOUSE_DRAGGED} events may not be delivered during a native
* Drag&Drop operation.
*
* In a multi-screen environment mouse drag events are delivered to the
! * <code>Component</code> even if the mouse position is outside the bounds of the
! * <code>GraphicsConfiguration</code> associated with that
! * <code>Component</code>. However, the reported position for mouse drag events
* in this case may differ from the actual mouse position:
* <ul>
* <li>In a multi-screen environment without a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
! * bounds of the <code>GraphicsConfiguration</code> associated with
! * the <code>Component</code>.
* <li>In a multi-screen environment with a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
! * bounds of the virtual device associated with the <code>Component</code>.
* </ul>
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
* of any particular {@code MouseEvent} instance is not
* in the range from {@code MOUSE_FIRST} to {@code MOUSE_LAST}-1
--- 152,175 ----
* {@code Component}). Due to platform-dependent Drag&Drop implementations,
* {@code MOUSE_DRAGGED} events may not be delivered during a native
* Drag&Drop operation.
*
* In a multi-screen environment mouse drag events are delivered to the
! * {@code Component} even if the mouse position is outside the bounds of the
! * {@code GraphicsConfiguration} associated with that
! * {@code Component}. However, the reported position for mouse drag events
* in this case may differ from the actual mouse position:
* <ul>
* <li>In a multi-screen environment without a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
! * bounds of the {@code GraphicsConfiguration} associated with
! * the {@code Component}.
* <li>In a multi-screen environment with a virtual device:
* <br>
* The reported coordinates for mouse drag events are clipped to fit within the
! * bounds of the virtual device associated with the {@code Component}.
* </ul>
* <p>
* An unspecified behavior will be caused if the {@code id} parameter
* of any particular {@code MouseEvent} instance is not
* in the range from {@code MOUSE_FIRST} to {@code MOUSE_LAST}-1
*** 198,252 ****
* The last number in the range of ids used for mouse events.
*/
public static final int MOUSE_LAST = 507;
/**
! * The "mouse clicked" event. This <code>MouseEvent</code>
* occurs when a mouse button is pressed and released.
*/
public static final int MOUSE_CLICKED = MOUSE_FIRST;
/**
! * The "mouse pressed" event. This <code>MouseEvent</code>
* occurs when a mouse button is pushed down.
*/
public static final int MOUSE_PRESSED = 1 + MOUSE_FIRST; //Event.MOUSE_DOWN
/**
! * The "mouse released" event. This <code>MouseEvent</code>
* occurs when a mouse button is let up.
*/
public static final int MOUSE_RELEASED = 2 + MOUSE_FIRST; //Event.MOUSE_UP
/**
! * The "mouse moved" event. This <code>MouseEvent</code>
* occurs when the mouse position changes.
*/
public static final int MOUSE_MOVED = 3 + MOUSE_FIRST; //Event.MOUSE_MOVE
/**
! * The "mouse entered" event. This <code>MouseEvent</code>
* occurs when the mouse cursor enters the unobscured part of component's
* geometry.
*/
public static final int MOUSE_ENTERED = 4 + MOUSE_FIRST; //Event.MOUSE_ENTER
/**
! * The "mouse exited" event. This <code>MouseEvent</code>
* occurs when the mouse cursor exits the unobscured part of component's
* geometry.
*/
public static final int MOUSE_EXITED = 5 + MOUSE_FIRST; //Event.MOUSE_EXIT
/**
! * The "mouse dragged" event. This <code>MouseEvent</code>
* occurs when the mouse position changes while a mouse button is pressed.
*/
public static final int MOUSE_DRAGGED = 6 + MOUSE_FIRST; //Event.MOUSE_DRAG
/**
! * The "mouse wheel" event. This is the only <code>MouseWheelEvent</code>.
* It occurs when a mouse equipped with a wheel has its wheel rotated.
* @since 1.4
*/
public static final int MOUSE_WHEEL = 7 + MOUSE_FIRST;
--- 198,252 ----
* The last number in the range of ids used for mouse events.
*/
public static final int MOUSE_LAST = 507;
/**
! * The "mouse clicked" event. This {@code MouseEvent}
* occurs when a mouse button is pressed and released.
*/
public static final int MOUSE_CLICKED = MOUSE_FIRST;
/**
! * The "mouse pressed" event. This {@code MouseEvent}
* occurs when a mouse button is pushed down.
*/
public static final int MOUSE_PRESSED = 1 + MOUSE_FIRST; //Event.MOUSE_DOWN
/**
! * The "mouse released" event. This {@code MouseEvent}
* occurs when a mouse button is let up.
*/
public static final int MOUSE_RELEASED = 2 + MOUSE_FIRST; //Event.MOUSE_UP
/**
! * The "mouse moved" event. This {@code MouseEvent}
* occurs when the mouse position changes.
*/
public static final int MOUSE_MOVED = 3 + MOUSE_FIRST; //Event.MOUSE_MOVE
/**
! * The "mouse entered" event. This {@code MouseEvent}
* occurs when the mouse cursor enters the unobscured part of component's
* geometry.
*/
public static final int MOUSE_ENTERED = 4 + MOUSE_FIRST; //Event.MOUSE_ENTER
/**
! * The "mouse exited" event. This {@code MouseEvent}
* occurs when the mouse cursor exits the unobscured part of component's
* geometry.
*/
public static final int MOUSE_EXITED = 5 + MOUSE_FIRST; //Event.MOUSE_EXIT
/**
! * The "mouse dragged" event. This {@code MouseEvent}
* occurs when the mouse position changes while a mouse button is pressed.
*/
public static final int MOUSE_DRAGGED = 6 + MOUSE_FIRST; //Event.MOUSE_DRAG
/**
! * The "mouse wheel" event. This is the only {@code MouseWheelEvent}.
* It occurs when a mouse equipped with a wheel has its wheel rotated.
* @since 1.4
*/
public static final int MOUSE_WHEEL = 7 + MOUSE_FIRST;
*** 318,331 ****
/**
* Indicates the number of quick consecutive clicks of
* a mouse button.
* clickCount will be valid for only three mouse events :<BR>
! * <code>MOUSE_CLICKED</code>,
! * <code>MOUSE_PRESSED</code> and
! * <code>MOUSE_RELEASED</code>.
! * For the above, the <code>clickCount</code> will be at least 1.
* For all other events the count will be 0.
*
* @serial
* @see #getClickCount()
*/
--- 318,331 ----
/**
* Indicates the number of quick consecutive clicks of
* a mouse button.
* clickCount will be valid for only three mouse events :<BR>
! * {@code MOUSE_CLICKED},
! * {@code MOUSE_PRESSED} and
! * {@code MOUSE_RELEASED}.
! * For the above, the {@code clickCount} will be at least 1.
* For all other events the count will be 0.
*
* @serial
* @see #getClickCount()
*/
*** 363,374 ****
int button;
/**
* A property used to indicate whether a Popup Menu
* should appear with a certain gestures.
! * If <code>popupTrigger</code> = <code>false</code>,
! * no popup menu should appear. If it is <code>true</code>
* then a popup menu should appear.
*
* @serial
* @see java.awt.PopupMenu
* @see #isPopupTrigger()
--- 363,374 ----
int button;
/**
* A property used to indicate whether a Popup Menu
* should appear with a certain gestures.
! * If {@code popupTrigger} = {@code false},
! * no popup menu should appear. If it is {@code true}
* then a popup menu should appear.
*
* @serial
* @see java.awt.PopupMenu
* @see #isPopupTrigger()
*** 413,423 ****
* desktop area could span multiple physical screen devices,
* these coordinates are relative to the virtual coordinate system.
* Otherwise, these coordinates are relative to the coordinate system
* associated with the Component's GraphicsConfiguration.
*
! * @return a <code>Point</code> object containing the absolute x
* and y coordinates.
*
* @see java.awt.GraphicsConfiguration
* @since 1.6
*/
--- 413,423 ----
* desktop area could span multiple physical screen devices,
* these coordinates are relative to the virtual coordinate system.
* Otherwise, these coordinates are relative to the coordinate system
* associated with the Component's GraphicsConfiguration.
*
! * @return a {@code Point} object containing the absolute x
* and y coordinates.
*
* @see java.awt.GraphicsConfiguration
* @since 1.6
*/
*** 458,489 ****
public int getYOnScreen() {
return yAbs;
}
/**
! * Constructs a <code>MouseEvent</code> object with the
* specified source component,
* type, time, modifiers, coordinates, click count, popupTrigger flag,
* and button number.
* <p>
* 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
! * <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)</tt>
* behaves in exactly the same way as the invocation
! * <tt> {@link #MouseEvent(Component, int, long, int, int, int,
! * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
! * x, y, xAbs, yAbs, clickCount, popupTrigger, button)</tt>
* 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
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
--- 458,489 ----
public int getYOnScreen() {
return yAbs;
}
/**
! * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, click count, popupTrigger flag,
* and button number.
* <p>
* 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
! * {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger, button)}
* behaves in exactly the same way as the invocation
! * {@link #MouseEvent(Component, int, long, int, int, int,
! * int, int, int, boolean, int) 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
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
*** 525,544 ****
* using buttons from the range starting from 4 to
* {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
! * @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
! * @throws IllegalArgumentException if an invalid <code>button</code>
* value is passed in
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
--- 525,544 ----
* using buttons from the range starting from 4 to
* {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
! * @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
! * @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
*** 563,588 ****
this.yAbs = 0;
}
}
/**
! * Constructs a <code>MouseEvent</code> object with the
* specified source component,
* type, modifiers, coordinates, click count, and popupTrigger flag.
* An invocation of the form
! * <tt>MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)</tt>
* behaves in exactly the same way as the invocation
! * <tt> {@link #MouseEvent(Component, int, long, int, int, int,
! * int, int, int, boolean, int) MouseEvent}(source, id, when, modifiers,
! * x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)</tt>
* 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 <code>IllegalArgumentException</code>
! * if <code>source</code> is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
--- 563,588 ----
this.yAbs = 0;
}
}
/**
! * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, modifiers, coordinates, click count, and popupTrigger flag.
* An invocation of the form
! * {@code MouseEvent(source, id, when, modifiers, x, y, clickCount, popupTrigger)}
* behaves in exactly the same way as the invocation
! * {@link #MouseEvent(Component, int, long, int, int, int,
! * int, int, int, boolean, int) MouseEvent(source, id, when, modifiers,
! * x, y, xAbs, yAbs, clickCount, popupTrigger, MouseEvent.NOBUTTON)}
* 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 {@code IllegalArgumentException}
! * if {@code source} is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
*** 603,613 ****
* @param clickCount The number of mouse clicks associated with event.
* Passing negative value
* is not recommended
* @param popupTrigger A boolean that equals {@code true} if this event
* is a trigger for a popup menu
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
--- 603,613 ----
* @param clickCount The number of mouse clicks associated with event.
* Passing negative value
* is not recommended
* @param popupTrigger A boolean that equals {@code true} if this event
* is a trigger for a popup menu
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
*** 635,645 ****
}
return tmpModifiers & ~JDK_1_3_MODIFIERS;
}
/**
! * Constructs a <code>MouseEvent</code> object with the
* specified source component,
* type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag,
* and button number.
* <p>
* Creating an invalid event (such
--- 635,645 ----
}
return tmpModifiers & ~JDK_1_3_MODIFIERS;
}
/**
! * Constructs a {@code MouseEvent} object with the
* specified source component,
* type, time, modifiers, coordinates, absolute coordinates, click count, popupTrigger flag,
* and button number.
* <p>
* Creating an invalid event (such
*** 647,660 ****
* values which don't match) results in unspecified behavior.
* Even if inconsistent values for relative and absolute coordinates are
* passed to the constructor, the mouse event instance is still
* created and no exception is thrown.
* This method throws an
! * <code>IllegalArgumentException</code> if <code>source</code>
! * is <code>null</code>.
*
! * @param source The <code>Component</code> that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
--- 647,660 ----
* values which don't match) results in unspecified behavior.
* Even if inconsistent values for relative and absolute coordinates are
* passed to the constructor, the mouse event instance is still
* created and no exception is thrown.
* This method throws an
! * {@code IllegalArgumentException} if {@code source}
! * is {@code null}.
*
! * @param source The {@code Component} that originated the event
* @param id An integer indicating the type of event.
* For information on allowable values, see
* the class description for {@link MouseEvent}
* @param when A long integer that gives the time the event occurred.
* Passing negative or zero value
*** 700,719 ****
* using buttons from the range starting from 4 to
* {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
! * @throws IllegalArgumentException if <code>source</code> is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
! * @throws IllegalArgumentException if an invalid <code>button</code>
* value is passed in
! * @throws IllegalArgumentException if <code>source</code> is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
--- 700,719 ----
* using buttons from the range starting from 4 to
* {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
* if the mouse has more than three buttons.
* </ul>
* @throws IllegalArgumentException if {@code button} is less then zero
! * @throws IllegalArgumentException if {@code source} is null
* @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
* {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
* @throws IllegalArgumentException if {@code button} is greater then the
* {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
* for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
* by Java
! * @throws IllegalArgumentException if an invalid {@code button}
* value is passed in
! * @throws IllegalArgumentException if {@code source} is null
* @see #getSource()
* @see #getID()
* @see #getWhen()
* @see #getModifiers()
* @see #getX()
*** 801,811 ****
}
/**
* Returns the x,y position of the event relative to the source component.
*
! * @return a <code>Point</code> object containing the x and y coordinates
* relative to the source component
*
*/
public Point getPoint() {
int x;
--- 801,811 ----
}
/**
* Returns the x,y position of the event relative to the source component.
*
! * @return a {@code Point} object containing the x and y coordinates
* relative to the source component
*
*/
public Point getPoint() {
int x;
*** 817,827 ****
return new Point(x, y);
}
/**
* Translates the event's coordinates to a new position
! * by adding specified <code>x</code> (horizontal) and <code>y</code>
* (vertical) offsets.
*
* @param x the horizontal x value to add to the current x
* coordinate position
* @param y the vertical y value to add to the current y
--- 817,827 ----
return new Point(x, y);
}
/**
* Translates the event's coordinates to a new position
! * by adding specified {@code x} (horizontal) and {@code y}
* (vertical) offsets.
*
* @param x the horizontal x value to add to the current x
* coordinate position
* @param y the vertical y value to add to the current y
*** 899,931 ****
/**
* Returns whether or not this mouse event is the popup menu
* trigger event for the platform.
* <p><b>Note</b>: Popup menus are triggered differently
! * on different systems. Therefore, <code>isPopupTrigger</code>
! * should be checked in both <code>mousePressed</code>
! * and <code>mouseReleased</code>
* for proper cross-platform functionality.
*
* @return boolean, true if this event is the popup menu trigger
* for this platform
*/
public boolean isPopupTrigger() {
return popupTrigger;
}
/**
! * Returns a <code>String</code> instance describing the modifier keys and
* mouse buttons that were down during the event, such as "Shift",
* or "Ctrl+Shift". These strings can be localized by changing
! * the <code>awt.properties</code> file.
* <p>
! * Note that the <code>InputEvent.ALT_MASK</code> and
! * <code>InputEvent.BUTTON2_MASK</code> have equal values,
* so the "Alt" string is returned for both modifiers. Likewise,
! * the <code>InputEvent.META_MASK</code> and
! * <code>InputEvent.BUTTON3_MASK</code> have equal values,
* so the "Meta" string is returned for both modifiers.
* <p>
* Note that passing negative parameter is incorrect,
* and will cause the returning an unspecified string.
* Zero parameter means that no modifiers were passed and will
--- 899,931 ----
/**
* Returns whether or not this mouse event is the popup menu
* trigger event for the platform.
* <p><b>Note</b>: Popup menus are triggered differently
! * on different systems. Therefore, {@code isPopupTrigger}
! * should be checked in both {@code mousePressed}
! * and {@code mouseReleased}
* for proper cross-platform functionality.
*
* @return boolean, true if this event is the popup menu trigger
* for this platform
*/
public boolean isPopupTrigger() {
return popupTrigger;
}
/**
! * Returns a {@code String} instance describing the modifier keys and
* mouse buttons that were down during the event, such as "Shift",
* or "Ctrl+Shift". These strings can be localized by changing
! * the {@code awt.properties} file.
* <p>
! * Note that the {@code InputEvent.ALT_MASK} and
! * {@code InputEvent.BUTTON2_MASK} have equal values,
* so the "Alt" string is returned for both modifiers. Likewise,
! * the {@code InputEvent.META_MASK} and
! * {@code InputEvent.BUTTON3_MASK} have equal values,
* so the "Meta" string is returned for both modifiers.
* <p>
* Note that passing negative parameter is incorrect,
* and will cause the returning an unspecified string.
* Zero parameter means that no modifiers were passed and will
< prev index next >