/** * Sets the position of the cursor. * * @param value the position */ public void setCaretPosition(int value) { m_TextPane.setCaretPosition(value); }
/** * Sets the position of the cursor at the end. */ public void setCaretPositionLast() { setCaretPosition(getDocument().getLength()); } }
/** * Appends the text at the end. * * @param text the text to append * @param a the attribute set, null if to use current */ public synchronized void append(String text, AttributeSet a) { StyledDocument doc; doc = getStyledDocument(); try { doc.insertString(doc.getLength(), text, a); } catch (Exception e) { System.err.println("Failed to insert text: " + text); e.printStackTrace(); } setCaretPosition(doc.getLength()); }