|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectpackageForL9L10.SimpleThreeDotModel_v2
public class SimpleThreeDotModel_v2
The class encapsulates a data model that consists of an ordered list of three dots (the first, second and third dot).
Each dot is understood to have a diameter (of a certain number of units, where the actual physical size of the unit is left unspecified and is abstracted away). Each dot is understood to have a location, which is specified as an x, y coordinate in a two-dimensional plane that has its origin in the upper left corner. Each dot is understood to be associated with a color (the first with red, the second with blue, and the third with green).
This model is capable of having listeners installed upon it. Anytime this model changes, the listener's changed() method will be invoked.
Constructor Summary | |
---|---|
SimpleThreeDotModel_v2()
Creates a default version of this data model in which the first dot is in location (20, 20), the second in location (30, 30), and the third in location (40, 40). |
Method Summary | |
---|---|
void |
addListener(DotModelListener listener)
Installs the passed listener on this model. |
void |
changeDiameterofDot2(int newDiameter)
Causes the second dot to have a new diameter as specified by the passed value. |
java.awt.Color |
getColour1()
Returns the colour associated with the first dot. |
java.awt.Color |
getColour2()
Returns the colour associated with the second dot. |
java.awt.Color |
getColour3()
Returns the colour associated with the third dot. |
java.awt.geom.Ellipse2D |
getDot1()
Returns the circular shape that is associated with the first dot. |
java.awt.geom.Ellipse2D |
getDot2()
Returns the circular shape that is associated with the second dot. |
java.awt.geom.Ellipse2D |
getDot3()
Returns the circular shape that is associated with the third dot. |
void |
nudgeToRightDot1()
Causes the first dot to be nudged to the right by a small amount. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleThreeDotModel_v2()
Method Detail |
---|
public java.awt.Color getColour1()
public java.awt.Color getColour2()
public java.awt.Color getColour3()
public java.awt.geom.Ellipse2D getDot1()
public java.awt.geom.Ellipse2D getDot2()
public java.awt.geom.Ellipse2D getDot3()
public void nudgeToRightDot1()
public void changeDiameterofDot2(int newDiameter)
public void addListener(DotModelListener listener)
listener
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |