|
@@ -1,11 +1,15 @@
|
|
|
import java.util.Observable;
|
|
|
import java.util.*;
|
|
|
-import java.awt.Color;
|
|
|
+import java.awt.*;
|
|
|
|
|
|
public class Model extends Observable
|
|
|
{
|
|
|
/** The observers that are watching this model for changes. */
|
|
|
private List<Observer> observers;
|
|
|
+ private List<Thingy> thingies;
|
|
|
+ private Thingy curThingy;
|
|
|
+ private Color curColour;
|
|
|
+ private int curThiccness;
|
|
|
public Color menuColour;
|
|
|
public Color sideColour;
|
|
|
public Color controlColour;
|
|
@@ -14,9 +18,22 @@ public class Model extends Observable
|
|
|
public Model()
|
|
|
{
|
|
|
this.observers = new ArrayList();
|
|
|
+ this.thingies = new ArrayList();
|
|
|
setChanged();
|
|
|
}
|
|
|
|
|
|
+ public void newThingy(int x, int y)
|
|
|
+ {
|
|
|
+ curThingy = new Thingy(curColour, curThiccness);
|
|
|
+ thingies.add(curThingy);
|
|
|
+ curThingy.addPoint(x, y);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addPoint(int x, int y)
|
|
|
+ {
|
|
|
+ curThingy.addPoint(x, y);
|
|
|
+ }
|
|
|
+
|
|
|
public void setMenuColour(Color c)
|
|
|
{
|
|
|
menuColour = c;
|
|
@@ -59,3 +76,22 @@ public class Model extends Observable
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+class Thingy
|
|
|
+{
|
|
|
+ private List<Point> points;
|
|
|
+ private Color colour;
|
|
|
+ private int thiccness;
|
|
|
+
|
|
|
+ public Thingy(Color c, int x)
|
|
|
+ {
|
|
|
+ points = new ArrayList();
|
|
|
+ this.colour = c;
|
|
|
+ this.thiccness = x;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addPoint(int x, int y)
|
|
|
+ {
|
|
|
+ points.add(new Point(x, y));
|
|
|
+ }
|
|
|
+}
|