|
Spirograph Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectspirograph.SetPosGravListener
This code implements a listener which listens to the DotPanel and waits for mouse clicks. Depending on what "mode" it is in, the SetPosGravListener will either add in a new gravitational source, reposition the dot or do nothing. The mode of this listener is change by some of the button listeners in the AdvEnv instance.
Copyright © 1998 Massachusetts Institute of Technology
Copyright © 2003 Franklin W. Olin College of Engineering
Coord
,
DotPanel
Field Summary | |
static int |
GRAV
Signifies that a gravity point should be added when the mouse is clicked in the DotPanel. |
static int |
NONE
Signifies that no action should be taken when the mouse is clicked in the DotPanel. |
static int |
POS
Signifies that the ball position should be set when the mouse is clicked in the DotPanel. |
Constructor Summary | |
SetPosGravListener(Coord xCoord,
Coord yCoord,
DotPanel myPanel)
Creates a new SetPosGravListener that knows about a DotPanel and it's associated Coordinates. |
Method Summary | |
void |
mouseClicked(java.awt.event.MouseEvent e)
Stub to fulfill MouseListener. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Stub to fulfill MouseListener. |
void |
mouseExited(java.awt.event.MouseEvent e)
Stub to fulfill MouseListener. |
void |
mousePressed(java.awt.event.MouseEvent e)
Perform our mode dependant behavior. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Stub to fulfill MouseListener. |
void |
setMode(int mode)
Change the mode of operation of this listener. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NONE
public static final int POS
public static final int GRAV
Constructor Detail |
public SetPosGravListener(Coord xCoord, Coord yCoord, DotPanel myPanel)
xCoord
- The x coordinateyCoord
- the y coordinate.myPanel
- The dot panel for which we will be a mouse listener.Method Detail |
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
e
- The mouse event we are to react topublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
e
- A MouseEventpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
e
- A MouseEventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
e
- A MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
e
- A MouseEventpublic void setMode(int mode)
mode
- The new mode for this listener.
|
Spirograph Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |