lt05_pkg
Class DotController_VersionForQuestion6
java.lang.Object
lt05_pkg.DotController_VersionForQuestion6
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
public class DotController_VersionForQuestion6
- extends java.lang.Object
- implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
This class encapsulates a MouseListener that is installed upon a particular
JFrame. When a mouse motion event is detected, this controller changes the
PolkaDotDataModel. For specific details, see mouseMoved(MouseEvent)
- Author:
- mb
Method Summary |
void |
mouseClicked(java.awt.event.MouseEvent e)
This method does cause anything to happen to the data model. |
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)
This method causes the data model to be changed when a mouse move event
is detected. |
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DotController_VersionForQuestion6
public DotController_VersionForQuestion6(javax.swing.JFrame view,
PolkaDotDataModel model)
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- This method does cause anything to happen to the data model. See
mouseMoved(MouseEvent)
instead.
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- This method causes the data model to be changed when a mouse move event
is detected. What this method should do:
any time the user moves the mouse pointer, evaluate whether the pointer
has passed inside a polka dot. If the mouse pointer passes inside a polka
dot, then the polka dot should change: if it is unfilled, then it should
become filled. If it is filled, then it should become unfilled. The
effect is that as the user moves the mouse track point within a polka
dot, the polka dot should toggle rapidly between between filled and
unfilled.
Hint: look at the services provided by the class
PolkaDot
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener