View Javadoc
1   package org.woehlke.simulation.evolution.gui;
2   
3   import org.woehlke.simulation.evolution.dom.ISimGenWorld;
4   import org.woehlke.simulation.evolution.dom.SimGenWorld;
5   import org.woehlke.simulation.evolution.activities.ISimGenController;
6   import org.woehlke.simulation.evolution.activities.SimGenController;
7   import org.woehlke.simulation.evolution.beans.SimGenPoint;
8   
9   import java.applet.Applet;
10  import java.awt.*;
11  
12  /**
13   * (C) 2006 - 2008 Thomas Woehlke
14   * http://www.thomas-woehlke.de
15   * @author Thomas Woehlke
16   * Date: 04.02.2006
17   * Time: 18:33:14
18   */
19  public class SimGenApplet extends Applet implements ISimGenApplet {
20      private Label title = new Label("SimGen");
21      private ISimGenController controllerThread;
22      private ISimGenWorldCanvas canvas;
23      private ISimGenWorld world;
24      private int scale = 2;
25      private int width = 320 * scale;
26      private int height = 234 * scale;
27  
28      public void init() {
29          scale = 2;
30          width = 320 * scale;
31          height = 234 * scale;
32          this.setLayout(new BorderLayout());
33          this.add(title, BorderLayout.NORTH);
34          controllerThread = new SimGenController();
35          world = new SimGenWorld(width, height);
36          canvas = new SimGenWorldCanvas(width, height);
37          canvas.setWorld(world);
38          this.add((Canvas) canvas, BorderLayout.CENTER);
39          controllerThread.setCanvas(canvas);
40          controllerThread.setWorld(world);
41          controllerThread.start();
42      }
43  
44      public void destroy() {
45      }
46  
47      public void stop() {
48      }
49  
50      public SimGenPoint getCanvasDimenensions() {
51          return canvas.getDimensions();
52      }
53  
54      public ISimGenWorldCanvas getCanvas() {
55          return canvas;
56      }
57  
58      public ISimGenController getControllerThread() {
59          return controllerThread;
60      }
61  
62      public void setControllerThread(ISimGenController controllerThread) {
63          this.controllerThread = controllerThread;
64      }
65  }