Java examples for javax.swing.text:StyledDocument
write Area Swing StyledDocument
//package com.java2s; import javax.swing.text.*; public class Main { static SimpleAttributeSet sas_bold = new SimpleAttributeSet(); static SimpleAttributeSet sas_noBold = new SimpleAttributeSet(); private static void writeArea(StyledDocument doc, String s, boolean bold) { try {//from w ww . j a va2 s . com if (bold) { doc.insertString(doc.getLength(), s, sas_bold); } else { doc.insertString(doc.getLength(), s, sas_noBold); } } catch (BadLocationException blex) { } } }