Example #1
0
  /**
   * Sets the document this text area is editing.
   *
   * @param document The document
   */
  public void setDocument(SyntaxDocument document) {
    if (this.document == document) return;
    if (this.document != null) this.document.removeDocumentListener(documentHandler);
    this.document = document;

    document.addDocumentListener(documentHandler);

    select(0, 0);
    updateScrollBars();
    painter.repaint();
  }
Example #2
0
 /** Moves the mark to the caret position. */
 public final void selectNone() {
   select(getCaretPosition(), getCaretPosition());
 }
Example #3
0
 /** Selects all text in the document. */
 public final void selectAll() {
   select(0, getDocumentLength());
 }
Example #4
0
 /**
  * Sets the caret position. The new selection will consist of the caret position only (hence no
  * text will be selected)
  *
  * @param caret The caret position
  * @see #select(int,int)
  */
 public final void setCaretPosition(int caret) {
   select(caret, caret);
 }
Example #5
0
 /**
  * Sets the selection end. The new selection will be the old selection start and the bew selection
  * end.
  *
  * @param selectionEnd The selection end
  * @see #select(int,int)
  */
 public final void setSelectionEnd(int selectionEnd) {
   select(selectionStart, selectionEnd);
 }