List of usage examples for javax.swing.text StyledDocument addStyle
public Style addStyle(String nm, Style parent);
From source file:org.smart.migrate.ui.ImportThread.java
private void addStylesToDocument(StyledDocument doc) { //Initialize some styles. Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); Style regular = doc.addStyle("regular", def); StyleConstants.setFontFamily(def, "SansSerif"); Style s = doc.addStyle("italic", regular); StyleConstants.setItalic(s, true); s = doc.addStyle("bold", regular); StyleConstants.setBold(s, true); s = doc.addStyle("small", regular); StyleConstants.setFontSize(s, 10); s = doc.addStyle("large", regular); StyleConstants.setFontSize(s, 16); s = doc.addStyle("icon", regular); StyleConstants.setAlignment(s, StyleConstants.ALIGN_CENTER); s = doc.addStyle("info", regular); StyleConstants.setForeground(s, Color.blue); s = doc.addStyle("error", regular); StyleConstants.setForeground(s, Color.red); s = doc.addStyle("warning", regular); StyleConstants.setForeground(s, Color.orange); s = doc.addStyle("gray", regular); StyleConstants.setForeground(s, Color.gray); s = doc.addStyle("success", regular); StyleConstants.setForeground(s, Color.green); }