Ejemplo n.º 1
0
  @Override
  public synchronized void run() {
    try {
      for (int i = 0; i < NUM_PIPES; i++) {
        while (Thread.currentThread() == reader[i]) {
          try {
            this.wait(100);
          } catch (InterruptedException ie) {
          }
          if (pin[i].available() != 0) {
            String input = this.readLine(pin[i]);
            appendMsg(htmlize(input));
            if (textArea.getDocument().getLength() > 0) {
              textArea.setCaretPosition(textArea.getDocument().getLength() - 1);
            }
          }
          if (quit) {
            return;
          }
        }
      }

    } catch (Exception e) {
      Debug.error(me + "Console reports an internal error:\n%s", e.getMessage());
    }
  }
Ejemplo n.º 2
0
  /** Start a FlocImporter in a new Thread. */
  public void start() {
    if (netThread != null) {
      throw new IllegalStateException("thread already started.");
    }

    netThread = new Thread(this);
    netThread.start();
  } // start()
Ejemplo n.º 3
0
  /**
   * Added this guy to make sure an image is loaded - ie no broken images. So far its used only for
   * images loaded off the disk (non-URL). It seems to work marvelously. By the way, it does the
   * same thing as MediaTracker, but you dont need to know the component its being rendered on. Rob
   */
  private void waitForImage() throws InterruptedException {
    int w = fImage.getWidth(this);
    int h = fImage.getHeight(this);

    while (true) {
      int flags = Toolkit.getDefaultToolkit().checkImage(fImage, w, h, this);

      if (((flags & ERROR) != 0) || ((flags & ABORT) != 0)) throw new InterruptedException();
      else if ((flags & (ALLBITS | FRAMEBITS)) != 0) return;
      Thread.sleep(10);
      // System.out.println("rise and shine...");
    }
  }
Ejemplo n.º 4
0
  private synchronized void closeAll() {
    try {
      // Close all child window
      WindowManager.closeAll();

      // Remove all child component
      pnlThread.setVisible(false);
      pnlUser.setVisible(false);
      pnlThread.removeAll();
      clearAll(txtBoard);
      tblUser.setData(new Vector());
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }