|
@@ -1,4 +1,3 @@
|
|
|
-import java.io.*;
|
|
|
import java.util.*;
|
|
|
import java.awt.*;
|
|
|
import javax.swing.*;
|
|
@@ -13,6 +12,7 @@ public class View extends JPanel implements Observer
|
|
|
// Hook up this observer so that it will be notified when the model
|
|
|
// changes.
|
|
|
this.model = model;
|
|
|
+ this.setBackground(Color.white);
|
|
|
model.addObserver(this);
|
|
|
this.addMouseMotionListener(handler);
|
|
|
this.addMouseListener(handler);
|
|
@@ -29,14 +29,15 @@ public class View extends JPanel implements Observer
|
|
|
|
|
|
public void paintComponent(Graphics g)
|
|
|
{
|
|
|
- Graphics gtemp = (Graphics2D) g;
|
|
|
- ArrayList<Thingy> thingies = m.getThingies();
|
|
|
+ super.paintComponent(g);
|
|
|
+ Graphics2D gtemp = (Graphics2D) g;
|
|
|
+ ArrayList<Thingy> thingies = model.getThingies();
|
|
|
|
|
|
for (Thingy t: thingies)
|
|
|
{
|
|
|
ArrayList<Point> points = t.getPoints();
|
|
|
- gtemp.setColor(points.get(0).getColour());
|
|
|
- gtemp.setStroke(new BasicStroke(p.getThiccness(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
|
|
+ gtemp.setColor(t.getColour());
|
|
|
+ gtemp.setStroke(new BasicStroke(t.getThiccness(), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
|
|
|
|
|
|
if ((points.size() == 1))
|
|
|
{
|