Java JTextPane appendString(String str, JTextPane jtext)

Here you can find the source of appendString(String str, JTextPane jtext)

Description

append String

License

Open Source License

Declaration

public static void appendString(String str, JTextPane jtext) throws BadLocationException 

Method Source Code


//package com.java2s;

import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.StyledDocument;

public class Main {
    public static void appendString(String str, JTextPane jtext) throws BadLocationException {
        StyledDocument document = (StyledDocument) jtext.getDocument();
        document.insertString(document.getLength(), str, null);
        // ^ or your style attribute  
    }//from w ww  .j  a v a 2s .c  o  m
}

Related

  1. addStyle(JTextPane textPane, String name, Color foreground)
  2. appendAsGreen(JTextPane pane, String fontName, int fontSize, String s)
  3. appendAsMessage(JTextPane pane, String fontName, int fontSize, String s)
  4. appendToPane(JTextPane textPane, String text, Color foregroundColor, Color backgroundColor)
  5. applyRegex(String regex, JTextPane pane, Color highlightColor)
  6. centerText(JTextPane pane)
  7. createJTextPane(String text, Color backgroundColor)