import java.awt.Color;
import javax.swing.JTextPane;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
public class Main {
public static void main(String[] argv) throws Exception {
JTextPane c1 = new JTextPane();
JTextPane c2 = new JTextPane();
StyleContext styleContext = new StyleContext();
c1.setDocument(new DefaultStyledDocument(styleContext));
c2.setDocument(new DefaultStyledDocument(styleContext));
Style style = c1.addStyle("style name", null);
StyleConstants.setForeground(style, Color.red);
style = c2.getStyle("style name");
StyleConstants.setBold(style, true);
}
}