lt05_pkg
Class DotController_VersionForQuestion4
java.lang.Object
lt05_pkg.DotController_VersionForQuestion4
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
public class DotController_VersionForQuestion4
- 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 clicked event is detected, this controller changes the
PolkaDotDataModel. For specific details, see
mouseClicked(MouseEvent)
- Author:
- mb
Method Summary |
void |
mouseClicked(java.awt.event.MouseEvent e)
This method causes the data model to be changed when a mouse click event
is detected. |
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)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DotController_VersionForQuestion4
public DotController_VersionForQuestion4(javax.swing.JFrame view,
PolkaDotDataModel model)
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- This method causes the data model to be changed when a mouse click event
is detected. What this method should do:
if the user clicks on a polka dot, and if the polka dot's position is in
the top half of the canvas (as determined on the basis of the polka dot's
centre point), then the polka dot should increase in size by 10%. if the
polka dot's position is in the bottom half of the canvas (as determined
on the basis of the polka dot's centre point), then the polka dot should
decrease in size by 10%.
Hint: look at the services provided by the class
PolkaDot
- 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)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener