1   package fi.jyu.mit.graphics;
2   
3   /**
4    * Luokka jonka avulla voi helposti piirtää kuvioita ruudulle.
5    * Ikkunaan voi lisätä kuvioita, esimerkiksi
6    * <pre>
7    *      window.addLine(0,0,100,100).setColor(Color.RED);
8    *      window.addCircle(0, 0, 1).setColor(Color.RED);
9    *      window.addShape(new Line(0, 0, 10, 10)).setColor(Color.RED);
10   * </pre>
11   * @author Markus Kivioja
12   */
13  public class EasyWindow extends Window implements Easy {
14      
15      private static final long serialVersionUID = 1;
16      
17      /**
18       * Luo uuden ikkunan
19       */
20      public EasyWindow() {
21          super();
22          this.setVisible(true);
23      }
24      
25      /**
26       * Luo uuden ikkunan
27       * @param width ikkunan leveys
28       * @param height ikkunan korkeus
29       */
30      public EasyWindow(int width, int height) {
31          super(width, height);
32          this.setVisible(true);
33      }
34      
35      @Override
36      public Drawable addShape(Drawable shape) {
37          return add(shape);
38      }
39  
40      @Override
41      public Line addLine(double x1, double y1, double x2, double y2) {
42          return (Line)add(new Line(x1, y1, x2, y2));
43      }
44      
45      
46      @Override
47      public Line addLine(double x1, double y1, double z1, double x2, double y2, double z2) {
48          return (Line)add(new Line(x1, y1, z1, x2, y2, z2));
49      }
50      
51  
52      @Override
53      public Circle addCircle(double x, double y, double r) {
54          return (Circle)add(new Circle(x, y, r));
55      }
56      
57      @Override
58      public Circle addCircle(double x, double y, double z, double r) {
59          return (Circle)add(new Circle(x, y, z, r));
60      }
61      
62  
63      @Override
64      public Polygon addPolygon(double[] xpoints, double[] ypoints) {
65          return (Polygon)add(new Polygon(xpoints, ypoints));
66      }
67  
68      @Override
69      public Polygon addPolygon(double[][] points) {
70          return (Polygon)add(new Polygon(points));
71      }
72      
73      @Override
74      public FillPolygon addFillPolygon(double[] xpoints, double[] ypoints) {
75          return (FillPolygon)add(new FillPolygon(xpoints, ypoints));
76      }
77  
78      @Override
79      public FillPolygon addFillPolygon(double[][] points) {
80          return (FillPolygon)add(new FillPolygon(points));
81      }
82  
83      @Override
84      public Axis addAxis(double xLength, double yLength, double zLength) {
85          return (Axis)add(new Axis(xLength, yLength, zLength));
86      }
87  
88      @Override
89      public Axis addAxis(double xLength, double yLength, double zLength, double x, double y, double z) {
90          return (Axis)add(new Axis(xLength, yLength, zLength, x, y, z));
91      }
92  }
93