|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jplay.InputBase jplay.Mouse
public class Mouse
Class responsible for handling mouse actions.
Field Summary | |
---|---|
static int |
BUTTON_LEFT
|
static int |
BUTTON_MIDDLE
|
static int |
BUTTON_RIGHT
|
Fields inherited from class jplay.InputBase |
---|
DETECT_EVERY_PRESS, DETECT_INITIAL_PRESS_ONLY |
Constructor Summary | |
---|---|
Mouse()
Class constructor. |
Method Summary | |
---|---|
java.awt.Point |
getPosition()
Returns the position of the mouse on the screen. |
boolean |
isLeftButtonPressed()
Returns true if the left button is pressed, otherwise false. |
boolean |
isMiddleButtonPressed()
Returns true if the middle button is pressed, otherwise false. |
boolean |
isOverArea(int minX,
int minY,
int maxX,
int maxY)
Returns true if the mouse is over an area, otherwise, return false |
boolean |
isOverArea(java.awt.Point start,
java.awt.Point end)
Returns true if the mouse is over an object, otherwise, return false. |
boolean |
isOverObject(GameObject obj)
Returns true if the mouse is over an object, otherwise, return false. |
boolean |
isRightButtonPressed()
Returns true if the right button is pressed, otherwise false. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
setBehavior(int numberBotton,
int behavior)
Sets the behavior of the mouse. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUTTON_LEFT
public static final int BUTTON_MIDDLE
public static final int BUTTON_RIGHT
Constructor Detail |
---|
public Mouse()
Method Detail |
---|
public java.awt.Point getPosition()
public boolean isLeftButtonPressed()
public boolean isMiddleButtonPressed()
public boolean isRightButtonPressed()
public void setBehavior(int numberBotton, int behavior)
numberBotton
- it's represent the mouse button and can be BUTTON_LEFT, BUTTON_MIDDLE or BUTTON RIGHT.behabior
- it's can be DETECT_EVERY_PRESS or DETECT_INITIAL_PRESS_ONLY.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public boolean isOverObject(GameObject obj)
obj
- any GameObject.
public boolean isOverArea(java.awt.Point start, java.awt.Point end)
start
- initial point of the area.end
- final point of the area.
public boolean isOverArea(int minX, int minY, int maxX, int maxY)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |