|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.MouseAdapter
javalib.funworld.MyMouseAdapter
class MyMouseAdapter
The implementation of callbacks for the mouse events: mouse clicked, entered, exited, pressed, and released.
We do not handle mouse motion events: mouse dragged and mouse moved.
Field Summary | |
---|---|
protected World |
currentWorld
the current
that handles the mouse events |
protected Posn |
mousePosn
the mouse position recorded by the mouse event handler |
Constructor Summary | |
---|---|
protected |
MyMouseAdapter(World currentWorld)
Create the mouse listener for the given . |
Method Summary | |
---|---|
(package private) Posn |
adjustMousePosn(Posn mousePosn)
Adjust the reported mouse position to account for the top bar |
void |
mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component. |
void |
mouseDragged(MouseEvent e)
Invoked when the mouse has been dragged in a component. |
void |
mouseEntered(MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved(MouseEvent e)
Invoked when the mouse has been moved in a component. |
void |
mousePressed(MouseEvent e)
Invoked when the mouse button has been pressed on a component. |
void |
mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component. |
Methods inherited from class java.awt.event.MouseAdapter |
---|
mouseWheelMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected World currentWorld
World
that handles the mouse events
protected Posn mousePosn
Constructor Detail |
---|
protected MyMouseAdapter(World currentWorld)
World
.
currentWorld
- the given World
Method Detail |
---|
Posn adjustMousePosn(Posn mousePosn)
mousePosn
- the recorded mouse position
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
mouseClicked
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
mouseEntered
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
mouseExited
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
mouseMoved
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
mousePressed
in class MouseAdapter
e
- the mouse event that invoked this callbackpublic void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
mouseReleased
in class MouseAdapter
e
- the mouse event that invoked this callback
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |