예제 #1
0
  /*
   *  To prevent memory from being used up you can control the number of
   *  lines to display in the console
   *
   *  This number can be dynamically changed, but the console will only
   *  be updated the next time the Document is updated.
   */
  public void setMessageLines(final int lines) {
    if (limitLinesListener != null) {
      document.removeDocumentListener(limitLinesListener);
    }

    limitLinesListener = new LimitLinesDocumentListener(lines, isAppend);
    document.addDocumentListener(limitLinesListener);
  }
예제 #2
0
 @Override
 public void replaceRange(final String text, final int start, final int end) {
   synchronized (getDelegateLock()) {
     // JTextArea.replaceRange() posts two different events.
     // Since we make no differences between text events,
     // the document listener has to be disabled while
     // JTextArea.replaceRange() is called.
     final Document document = getTextComponent().getDocument();
     document.removeDocumentListener(this);
     getDelegate().getView().replaceRange(text, start, end);
     revalidate();
     postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
     document.addDocumentListener(this);
   }
   repaintPeer();
 }
예제 #3
0
    public void propertyChange(PropertyChangeEvent evt) {
      String prop = evt.getPropertyName();
      Object src = evt.getSource();

      if (src.equals(searchField)) {
        if ("findPopupMenu".equals(prop)
            || "searchMode".equals(prop)
            || "useSeperatePopupButton".equals(prop)
            || "searchMode".equals(prop)
            || "layoutStyle".equals(prop)) {
          layoutButtons();
          updateButtons();
        } else if ("document".equals(prop)) {
          Document doc = (Document) evt.getOldValue();
          if (doc != null) {
            doc.removeDocumentListener(this);
          }
          doc = (Document) evt.getNewValue();
          if (doc != null) {
            doc.addDocumentListener(this);
          }
        }
      }
    }
예제 #4
0
 /** Cleans up. */
 public void finish() {
   document.removeDocumentListener(documentListener);
 }
예제 #5
0
 /**
  * Notify this {@link LineID} that it is no longer in use. Will stop position tracking. Call this
  * when this {@link LineID} is no longer needed.
  */
 public synchronized void stopTracking() {
   if (doc != null) {
     doc.removeDocumentListener(this);
     doc = null;
   }
 }