code: public void select(int start, int end) {
          int docEnd = textArea.getDocument().getLength();
          textArea.select(docEnd, docEnd);
          textArea.select(start, end);
      }
docs: Selects a range of characters.