Beispiel #1
0
  public static ZenInstance create(int width, int height, String options) {
    if (!mustBeAnWebApplet) mustBeAnApplication = true;
    synchronized (Zen.class) {
      ZenInstance instance = instanceMap.get();
      if (instance == null) { // no instance set for this thread
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // System.err.println("Creating Instance");
        Zen zen = new Zen();
        zen.bufferSize = new Dimension(width, height);
        zen.bufferOptions = options;
        zen.frame = frame;

        instanceMap.set(zen.master);
        Container pane = zen.frame.getContentPane();
        pane.add(zen);
        pane.setSize(zen.getSize());
        pane.setMinimumSize(zen.getSize());
        // frame.getContentPane().setIgnoreRepaint(true);
        zen.init();
        frame.pack();
        frame.setVisible(true);

        zen.start();
        return zen.master;
      }
      return instance;
    }
  }