Last change
on this file since 922 was
922,
checked in by sherbold, 12 years ago
|
- renaming of packages from de.ugoe.cs.quest to de.ugoe.cs.autoquest
|
-
Property svn:executable set to
*
|
File size:
1.7 KB
|
Rev | Line | |
---|
[786] | 1 |
|
---|
[922] | 2 | package de.ugoe.cs.autoquest.eventcore.gui;
|
---|
[544] | 3 |
|
---|
| 4 | /**
|
---|
[786] | 5 | * <p>
|
---|
| 6 | * Base class for all mouse interaction event types.
|
---|
| 7 | * </p>
|
---|
[544] | 8 | *
|
---|
[786] | 9 | * @version 1.0
|
---|
| 10 | * @author Patrick Harms
|
---|
[544] | 11 | */
|
---|
| 12 | public abstract class MouseButtonInteraction extends MouseInteraction {
|
---|
| 13 |
|
---|
[786] | 14 | /**
|
---|
| 15 | * <p>
|
---|
| 16 | * Id for object serialization.
|
---|
| 17 | * </p>
|
---|
| 18 | */
|
---|
[544] | 19 | private static final long serialVersionUID = 1L;
|
---|
| 20 |
|
---|
[786] | 21 | /**
|
---|
| 22 | * <p>
|
---|
| 23 | * Describes the pressed mouse button.
|
---|
| 24 | * </p>
|
---|
| 25 | *
|
---|
| 26 | * @version 1.0
|
---|
| 27 | * @author Patrick Harms
|
---|
| 28 | */
|
---|
[544] | 29 | public static enum Button {
|
---|
[590] | 30 | LEFT, MIDDLE, RIGHT, X;
|
---|
[544] | 31 | }
|
---|
| 32 |
|
---|
[786] | 33 | /**
|
---|
| 34 | * <p>
|
---|
| 35 | * The button used for mouse interaction
|
---|
| 36 | * </p>
|
---|
| 37 | */
|
---|
[550] | 38 | private Button button;
|
---|
[544] | 39 |
|
---|
| 40 | /**
|
---|
[786] | 41 | * <p>
|
---|
| 42 | * Constructor. Creates a new {@link MouseButtonInteraction}
|
---|
| 43 | * </p>
|
---|
[544] | 44 | *
|
---|
[786] | 45 | * @param button
|
---|
| 46 | * the button associated with the interaction
|
---|
[544] | 47 | */
|
---|
| 48 | public MouseButtonInteraction(Button button) {
|
---|
[550] | 49 | this.button = button;
|
---|
[544] | 50 | }
|
---|
| 51 |
|
---|
| 52 | /**
|
---|
[786] | 53 | * <p>
|
---|
| 54 | * Returns the button associated with the interaction.
|
---|
| 55 | * </p>
|
---|
| 56 | *
|
---|
| 57 | * @return the button
|
---|
[544] | 58 | */
|
---|
| 59 | public Button getButton() {
|
---|
[550] | 60 | return button;
|
---|
[544] | 61 | }
|
---|
[786] | 62 |
|
---|
[681] | 63 | /*
|
---|
| 64 | * (non-Javadoc)
|
---|
| 65 | *
|
---|
| 66 | * @see java.lang.Object#equals(java.lang.Object)
|
---|
| 67 | */
|
---|
| 68 | @Override
|
---|
| 69 | public boolean equals(Object obj) {
|
---|
| 70 | if (obj instanceof MouseButtonInteraction) {
|
---|
| 71 | return getButton().equals(((MouseButtonInteraction) obj).getButton());
|
---|
| 72 | }
|
---|
| 73 | return false;
|
---|
| 74 | }
|
---|
[544] | 75 |
|
---|
[681] | 76 | /*
|
---|
| 77 | * (non-Javadoc)
|
---|
| 78 | *
|
---|
| 79 | * @see java.lang.Object#hashCode()
|
---|
| 80 | */
|
---|
| 81 | @Override
|
---|
| 82 | public int hashCode() {
|
---|
| 83 | return getButton().hashCode();
|
---|
| 84 | }
|
---|
[544] | 85 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.