Exemplo n.º 1
0
  public static void main(String[] args) {
    if (model == null) {
      model = Arena.getInstance();
    }

    if (view == null) {
      view = new GameBoard(model);
    }

    if (control == null) {
      control = new GameEngine(model, view);
    }

    try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      adjustLAF();
    } catch (javax.swing.UnsupportedLookAndFeelException e) {
      System.err.println("Bully requires java-1.6 or higher");
    } catch (ClassNotFoundException e) {
      System.err.println("Bully requires java-1.6 or higher");
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    }

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            createAndShowGui(view);
          }
        });

    while (true) {
      Game game = new Game(control);
      GameThread thread = new GameThread(game);
      thread.start();
      while (thread.isAlive()) ;
    }
  }