hermes.postoffice
Class MouseMessage

java.lang.Object
  extended by hermes.postoffice.MouseMessage
All Implemented Interfaces:
Message

public class MouseMessage
extends java.lang.Object
implements Message

Message representing mouse actions.

Type of MouseMessage determined by the button pressed.

Subscription to a mouse button gets you press, release, and drag events; subscription to POConstants.Button.NO gets you mouse moved messages.


Constructor Summary
MouseMessage(POCodes.Button buttonClicked, POCodes.Click actionType, int x, int y)
          Creates a new MouseMessage.
 
Method Summary
 boolean equals(java.lang.Object o)
          Checks for equality of MouseMessages by comparing mouse button.
 POCodes.Click getAction()
          Gets the action designated by the message.
 POCodes.Button getButton()
          Gets the button pressed on the mouse.
 PVector getPosition()
          Gets position of mouse as PVector
 int getX()
          Gets the x location of the mouse
 int getY()
          Gets the y location of the mouse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseMessage

public MouseMessage(POCodes.Button buttonClicked,
                    POCodes.Click actionType,
                    int x,
                    int y)
Creates a new MouseMessage.

Parameters:
buttonClicked -
x -
y -
Method Detail

getButton

public POCodes.Button getButton()
Gets the button pressed on the mouse. Use constants defined in POCodes.Button to figure out what button has been pressed

Returns:
button type, compare against POCodes.Button

getAction

public POCodes.Click getAction()
Gets the action designated by the message. Compare w/ POCodes.Click to determined actions.

Returns:
action type, compare against POCodes.Click

getX

public int getX()
Gets the x location of the mouse

Returns:
int corresponding to x location

getY

public int getY()
Gets the y location of the mouse

Returns:
int corresponding to y location

getPosition

public PVector getPosition()
Gets position of mouse as PVector

Returns:
PVector w/ x,y coordinates

equals

public boolean equals(java.lang.Object o)
Checks for equality of MouseMessages by comparing mouse button.

Overrides:
equals in class java.lang.Object