|
@@ -26,4 +26,29 @@ public class View extends JPanel implements Observer
|
|
|
revalidate();
|
|
|
repaint();
|
|
|
}
|
|
|
+
|
|
|
+ public void paintComponent(Graphics g)
|
|
|
+ {
|
|
|
+ Graphics gtemp = (Graphics2D) g;
|
|
|
+ ArrayList<Thingy> thingies = m.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));
|
|
|
+
|
|
|
+ if ((points.size() == 1))
|
|
|
+ {
|
|
|
+ gtemp.drawLine(points.get(0).x, points.get(0).y, points.get(0).x, points.get(0).y);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int i = 1; i < points.size(); i++)
|
|
|
+ {
|
|
|
+ gtemp.drawLine(points.get(i - 1).x, points.get(i - 1).y, points.get(i).x, points.get(i).y);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|