瀏覽代碼

added methods to change model current thickness, colour. to be implemented with buttons, etc later

tarfeef101 6 年之前
父節點
當前提交
a36fb0639e
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      assignments/a2/src/main/java/Model.java

+ 16 - 0
assignments/a2/src/main/java/Model.java

@@ -20,6 +20,8 @@ public class Model extends Observable
   {
     this.observers = new ArrayList();
     this.thingies = new ArrayList();
+    this.curColour = Color.black;
+    this.curThiccness = 5;
     setChanged();
   }
   
@@ -64,6 +66,20 @@ public class Model extends Observable
     setChanged();
     notifyObservers();
   }
+  
+  public void changeThiccness(int x)
+  {
+    curThiccness = x;
+    setChanged();
+    notifyObservers();
+  }
+  
+  public void changeColour(Color c)
+  {
+    curColour = c;
+    setChanged();
+    notifyObservers();
+  }
 
   // Add observer to be notified on change
   public void addObserver(Observer observer)