Replace « JTextPane « Java Swing Q&A





2. add text into JTextPane through JButton, but not replace other text    coderanch.com

The append method only exists for a JTextArea. If you actually look at the source code you will see that it uses the insertString(...) method as I suggested above. So why don't you look at the source code so you will understand your coding error. Because using the insertString method is not complicated at all. Its Java 101 type coding where ...

3. Delete All/Replace All Text from JTextPane.    forums.oracle.com