Esempio n. 1
0
  /** Start the UI Rendering thread. */
  private void initUI() {
    setSize(dimension);
    add(board);

    setTitle("Game of Life");
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setLocationRelativeTo(null);

    Runnable r =
        () -> {
          while (true) {
            try {
              Thread.sleep(700);
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            board.revalidate();
            board.repaint();
          }
        };
    new Thread(r).start();
  }