< prev index next >

src/java.desktop/share/classes/java/awt/event/MouseEvent.java

Print this page




 509      * @param button       An integer that indicates, which of the mouse buttons has
 510      *                     changed its state.
 511      * The following rules are applied to this parameter:
 512      * <ul>
 513      * <li>If support for the extended mouse buttons is
 514      * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 515      * then it is allowed to create {@code MouseEvent} objects only with the standard buttons:
 516      * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and
 517      * {@code BUTTON3}.
 518      * <li> If support for the extended mouse buttons is
 519      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
 520      * then it is allowed to create {@code MouseEvent} objects with
 521      * the standard buttons.
 522      * In case the support for extended mouse buttons is
 523      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then
 524      * in addition to the standard buttons, {@code MouseEvent} objects can be created
 525      * using buttons from the range starting from 4 to
 526      * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 527      * if the mouse has more than three buttons.
 528      * </ul>
 529      * @throws IllegalArgumentException if {@code button} is less then zero
 530      * @throws IllegalArgumentException if {@code source} is null
 531      * @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
 532      *                                  {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 533      * @throws IllegalArgumentException if {@code button} is greater then the
 534      *                                  {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
 535      *                                  for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
 536      *                                  by Java
 537      * @throws IllegalArgumentException if an invalid {@code button}
 538      *            value is passed in
 539      * @throws IllegalArgumentException if {@code source} is null
 540      * @see #getSource()
 541      * @see #getID()
 542      * @see #getWhen()
 543      * @see #getModifiers()
 544      * @see #getX()
 545      * @see #getY()
 546      * @see #getClickCount()
 547      * @see #isPopupTrigger()
 548      * @see #getButton()
 549      * @since 1.4
 550      */
 551     public MouseEvent(Component source, int id, long when, int modifiers,
 552                       int x, int y, int clickCount, boolean popupTrigger,
 553                       int button)


 684      * @param button       An integer that indicates, which of the mouse buttons has
 685      *                     changed its state.
 686      * The following rules are applied to this parameter:
 687      * <ul>
 688      * <li>If support for the extended mouse buttons is
 689      * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 690      * then it is allowed to create {@code MouseEvent} objects only with the standard buttons:
 691      * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and
 692      * {@code BUTTON3}.
 693      * <li> If support for the extended mouse buttons is
 694      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
 695      * then it is allowed to create {@code MouseEvent} objects with
 696      * the standard buttons.
 697      * In case the support for extended mouse buttons is
 698      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then
 699      * in addition to the standard buttons, {@code MouseEvent} objects can be created
 700      * using buttons from the range starting from 4 to
 701      * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 702      * if the mouse has more than three buttons.
 703      * </ul>
 704      * @throws IllegalArgumentException if {@code button} is less then zero
 705      * @throws IllegalArgumentException if {@code source} is null
 706      * @throws IllegalArgumentException if {@code button} is greater then BUTTON3 and the support for extended mouse buttons is
 707      *                                  {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 708      * @throws IllegalArgumentException if {@code button} is greater then the
 709      *                                  {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
 710      *                                  for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
 711      *                                  by Java
 712      * @throws IllegalArgumentException if an invalid {@code button}
 713      *            value is passed in
 714      * @throws IllegalArgumentException if {@code source} is null
 715      * @see #getSource()
 716      * @see #getID()
 717      * @see #getWhen()
 718      * @see #getModifiers()
 719      * @see #getX()
 720      * @see #getY()
 721      * @see #getXOnScreen()
 722      * @see #getYOnScreen()
 723      * @see #getClickCount()
 724      * @see #isPopupTrigger()
 725      * @see #getButton()
 726      * @see #button
 727      * @see Toolkit#areExtraMouseButtonsEnabled()
 728      * @see java.awt.MouseInfo#getNumberOfButtons()


 848      * value.
 849      * The returned value includes at least the following constants:
 850      * <ul>
 851      * <li> {@code NOBUTTON}
 852      * <li> {@code BUTTON1}
 853      * <li> {@code BUTTON2}
 854      * <li> {@code BUTTON3}
 855      * </ul>
 856      * It is allowed to use those constants to compare with the returned button number in the application.
 857      * For example,
 858      * <pre>
 859      * if (anEvent.getButton() == MouseEvent.BUTTON1) {
 860      * </pre>
 861      * In particular, for a mouse with one, two, or three buttons this method may return the following values:
 862      * <ul>
 863      * <li> 0 ({@code NOBUTTON})
 864      * <li> 1 ({@code BUTTON1})
 865      * <li> 2 ({@code BUTTON2})
 866      * <li> 3 ({@code BUTTON3})
 867      * </ul>
 868      * Button numbers greater then {@code BUTTON3} have no constant identifier. So if a mouse with five buttons is
 869      * installed, this method may return the following values:
 870      * <ul>
 871      * <li> 0 ({@code NOBUTTON})
 872      * <li> 1 ({@code BUTTON1})
 873      * <li> 2 ({@code BUTTON2})
 874      * <li> 3 ({@code BUTTON3})
 875      * <li> 4
 876      * <li> 5
 877      * </ul>
 878      * <p>
 879      * Note: If support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 880      * then the AWT event subsystem does not produce mouse events for the extended mouse
 881      * buttons. So it is not expected that this method returns anything except {@code NOBUTTON}, {@code BUTTON1},
 882      * {@code BUTTON2}, {@code BUTTON3}.
 883      *
 884      * @return one of the values from 0 to {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 885      *         if support for the extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java.
 886      *         That range includes {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, {@code BUTTON3};
 887      *         <br>
 888      *         {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} or {@code BUTTON3}




 509      * @param button       An integer that indicates, which of the mouse buttons has
 510      *                     changed its state.
 511      * The following rules are applied to this parameter:
 512      * <ul>
 513      * <li>If support for the extended mouse buttons is
 514      * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 515      * then it is allowed to create {@code MouseEvent} objects only with the standard buttons:
 516      * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and
 517      * {@code BUTTON3}.
 518      * <li> If support for the extended mouse buttons is
 519      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
 520      * then it is allowed to create {@code MouseEvent} objects with
 521      * the standard buttons.
 522      * In case the support for extended mouse buttons is
 523      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then
 524      * in addition to the standard buttons, {@code MouseEvent} objects can be created
 525      * using buttons from the range starting from 4 to
 526      * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 527      * if the mouse has more than three buttons.
 528      * </ul>
 529      * @throws IllegalArgumentException if {@code button} is less than zero
 530      * @throws IllegalArgumentException if {@code source} is null
 531      * @throws IllegalArgumentException if {@code button} is greater than BUTTON3 and the support for extended mouse buttons is
 532      *                                  {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 533      * @throws IllegalArgumentException if {@code button} is greater than the
 534      *                                  {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
 535      *                                  for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
 536      *                                  by Java
 537      * @throws IllegalArgumentException if an invalid {@code button}
 538      *            value is passed in
 539      * @throws IllegalArgumentException if {@code source} is null
 540      * @see #getSource()
 541      * @see #getID()
 542      * @see #getWhen()
 543      * @see #getModifiers()
 544      * @see #getX()
 545      * @see #getY()
 546      * @see #getClickCount()
 547      * @see #isPopupTrigger()
 548      * @see #getButton()
 549      * @since 1.4
 550      */
 551     public MouseEvent(Component source, int id, long when, int modifiers,
 552                       int x, int y, int clickCount, boolean popupTrigger,
 553                       int button)


 684      * @param button       An integer that indicates, which of the mouse buttons has
 685      *                     changed its state.
 686      * The following rules are applied to this parameter:
 687      * <ul>
 688      * <li>If support for the extended mouse buttons is
 689      * {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 690      * then it is allowed to create {@code MouseEvent} objects only with the standard buttons:
 691      * {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, and
 692      * {@code BUTTON3}.
 693      * <li> If support for the extended mouse buttons is
 694      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java
 695      * then it is allowed to create {@code MouseEvent} objects with
 696      * the standard buttons.
 697      * In case the support for extended mouse buttons is
 698      * {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java, then
 699      * in addition to the standard buttons, {@code MouseEvent} objects can be created
 700      * using buttons from the range starting from 4 to
 701      * {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 702      * if the mouse has more than three buttons.
 703      * </ul>
 704      * @throws IllegalArgumentException if {@code button} is less than zero
 705      * @throws IllegalArgumentException if {@code source} is null
 706      * @throws IllegalArgumentException if {@code button} is greater than BUTTON3 and the support for extended mouse buttons is
 707      *                                  {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 708      * @throws IllegalArgumentException if {@code button} is greater than the
 709      *                                  {@link java.awt.MouseInfo#getNumberOfButtons() current number of buttons} and the support
 710      *                                  for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled}
 711      *                                  by Java
 712      * @throws IllegalArgumentException if an invalid {@code button}
 713      *            value is passed in
 714      * @throws IllegalArgumentException if {@code source} is null
 715      * @see #getSource()
 716      * @see #getID()
 717      * @see #getWhen()
 718      * @see #getModifiers()
 719      * @see #getX()
 720      * @see #getY()
 721      * @see #getXOnScreen()
 722      * @see #getYOnScreen()
 723      * @see #getClickCount()
 724      * @see #isPopupTrigger()
 725      * @see #getButton()
 726      * @see #button
 727      * @see Toolkit#areExtraMouseButtonsEnabled()
 728      * @see java.awt.MouseInfo#getNumberOfButtons()


 848      * value.
 849      * The returned value includes at least the following constants:
 850      * <ul>
 851      * <li> {@code NOBUTTON}
 852      * <li> {@code BUTTON1}
 853      * <li> {@code BUTTON2}
 854      * <li> {@code BUTTON3}
 855      * </ul>
 856      * It is allowed to use those constants to compare with the returned button number in the application.
 857      * For example,
 858      * <pre>
 859      * if (anEvent.getButton() == MouseEvent.BUTTON1) {
 860      * </pre>
 861      * In particular, for a mouse with one, two, or three buttons this method may return the following values:
 862      * <ul>
 863      * <li> 0 ({@code NOBUTTON})
 864      * <li> 1 ({@code BUTTON1})
 865      * <li> 2 ({@code BUTTON2})
 866      * <li> 3 ({@code BUTTON3})
 867      * </ul>
 868      * Button numbers greater than {@code BUTTON3} have no constant identifier. So if a mouse with five buttons is
 869      * installed, this method may return the following values:
 870      * <ul>
 871      * <li> 0 ({@code NOBUTTON})
 872      * <li> 1 ({@code BUTTON1})
 873      * <li> 2 ({@code BUTTON2})
 874      * <li> 3 ({@code BUTTON3})
 875      * <li> 4
 876      * <li> 5
 877      * </ul>
 878      * <p>
 879      * Note: If support for extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() disabled} by Java
 880      * then the AWT event subsystem does not produce mouse events for the extended mouse
 881      * buttons. So it is not expected that this method returns anything except {@code NOBUTTON}, {@code BUTTON1},
 882      * {@code BUTTON2}, {@code BUTTON3}.
 883      *
 884      * @return one of the values from 0 to {@link java.awt.MouseInfo#getNumberOfButtons() MouseInfo.getNumberOfButtons()}
 885      *         if support for the extended mouse buttons is {@link Toolkit#areExtraMouseButtonsEnabled() enabled} by Java.
 886      *         That range includes {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2}, {@code BUTTON3};
 887      *         <br>
 888      *         {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} or {@code BUTTON3}


< prev index next >