示例#1
0
  /** Iterate the physics, call repaint(). */
  public void run() {
    while (true) {
      repaint();
      try {
        canvas.changeSize(getHeight(), getWidth());
        simthread.sleep(10);
        canvasthread.run();
        canvasthread.join();

        // this.iters++;
      } catch (Exception ie) {
        System.out.println(ie.getMessage() + "!!!");
      }
      // System.out.println(iters + "!!");
    }
  }
  /**
   * Handle the button push events.
   *
   * @param evt, the associated ActionEvent object.
   */
  public void actionPerformed(ActionEvent evt) {

    Object source = evt.getSource();

    // Handle button events
    if (source instanceof JButton) {
      if (source == pbImport) {

        Thread thread = new Thread("UIImportXMLDialog: Import") { // $NON-NLS-1$
              public void run() {
                onImport();
              }
            };
        thread.run();

      } else if (source == pbClose) {
        onCancel();
      }
    }
  }