Java Code Examples for javax.swing.text.StyleConstants#setFontFamily()

The following examples show how to use javax.swing.text.StyleConstants#setFontFamily() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SeaGlassTextPaneUI.java    From seaglass with Apache License 2.0 7 votes vote down vote up
/**
 * Update the font in the default style of the document.
 *
 * @param font the new font to use or null to remove the font attribute
 *             from the document's style
 */
private void updateFont(Font font) {
    StyledDocument doc = (StyledDocument)getComponent().getDocument();
    Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);

    if (style == null) {
        return;
    }

    if (font == null) {
        style.removeAttribute(StyleConstants.FontFamily);
        style.removeAttribute(StyleConstants.FontSize);
        style.removeAttribute(StyleConstants.Bold);
        style.removeAttribute(StyleConstants.Italic);
    } else {
        StyleConstants.setFontFamily(style, font.getName());
        StyleConstants.setFontSize(style, font.getSize());
        StyleConstants.setBold(style, font.isBold());
        StyleConstants.setItalic(style, font.isItalic());
    }
}
 
Example 2
Source File: JConsole.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
private AttributeSet setStyle(
        String fontFamilyName, int size, Color color) {
    MutableAttributeSet attr = new SimpleAttributeSet();
    if (color != null) {
        StyleConstants.setForeground(attr, color);
    }
    if (fontFamilyName != null) {
        StyleConstants.setFontFamily(attr, fontFamilyName);
    }
    if (size != -1) {
        StyleConstants.setFontSize(attr, size);
    }

    setStyle(attr);

    return getStyle();
}
 
Example 3
Source File: JTerm.java    From MobyDroid with Apache License 2.0 6 votes vote down vote up
public JTerm(JTextPane jTextPane, JTermInputProcessor process, Color background, Color text, Font font) {
    super();
    jTermTextPane = jTextPane;
    processor = process;
    jTermDoc = new JTermDocument();
    jTermTextPane.setDocument(jTermDoc);

    jTermTextPane.setBackground(background);

    jTermTextPane.setCaretColor(text);
    jTermTextPane.addCaretListener(jTermDoc);
    jTermDoc.setCaret(jTermTextPane.getCaret());

    defaultStyle = jTermTextPane.getInputAttributes();
    StyleConstants.setFontFamily(defaultStyle, font.getFamily());
    StyleConstants.setFontSize(defaultStyle, font.getSize());
    StyleConstants.setItalic(defaultStyle, (font.getStyle() & Font.ITALIC) != 0);
    StyleConstants.setBold(defaultStyle, (font.getStyle() & Font.BOLD) != 0);
    StyleConstants.setForeground(defaultStyle, text);
    jTermDoc.setCharacterAttributes(0, jTermDoc.getLength() + 1, defaultStyle, false);

    jTermTextPane.addKeyListener(new JTermKeyListener()); //catch tabs, enters, and up/down arrows for autocomplete and input processing
    jTermTextPane.addMouseListener(new JTermMouseListener());
}
 
Example 4
Source File: PythonStdoutDocument.java    From binnavi with Apache License 2.0 6 votes vote down vote up
public PythonStdoutDocument() {
  StyleConstants.setFontFamily(outputAttrA, "Courier");
  StyleConstants.setFontSize(outputAttrA, 11);
  StyleConstants.setForeground(outputAttrA, new Color((float) .4, (float) .4, (float) .4));

  StyleConstants.setFontFamily(outputAttrB, "Courier");
  StyleConstants.setFontSize(outputAttrB, 11);
  StyleConstants.setForeground(outputAttrB, new Color((float) .1, (float) .1, (float) .1));

  StyleConstants.setFontFamily(outputErrAttr, "Courier");
  StyleConstants.setFontSize(outputErrAttr, 11);
  StyleConstants.setForeground(outputErrAttr, new Color(1, (float) .2, (float) .2));

  lastPosition = 0;
  flipflop = false;
  outputAttr = outputAttrA;
}
 
Example 5
Source File: SwingLogPanel.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
/** Set the font name. */
public void setFontName(String fontName) {
    if (log == null)
        return;
    this.fontName = fontName;
    log.setFont(new Font(fontName, Font.PLAIN, fontSize));
    StyleConstants.setFontFamily(styleRegular, fontName);
    StyleConstants.setFontFamily(styleBold, fontName);
    StyleConstants.setFontFamily(styleRed, fontName);
    StyleConstants.setFontSize(styleRegular, fontSize);
    StyleConstants.setFontSize(styleBold, fontSize);
    StyleConstants.setFontSize(styleRed, fontSize);
    // Changes all existing text
    StyledDocument doc = log.getStyledDocument();
    Style temp = doc.addStyle("temp", null);
    StyleConstants.setFontFamily(temp, fontName);
    StyleConstants.setFontSize(temp, fontSize);
    doc.setCharacterAttributes(0, doc.getLength(), temp, false);
    // Changes all existing hyperlinks
    Font newFont = new Font(fontName, Font.BOLD, fontSize);
    for (JLabel link : links) {
        link.setFont(newFont);
    }
}
 
Example 6
Source File: OurConsole.java    From org.alloytools.alloy with Apache License 2.0 6 votes vote down vote up
static MutableAttributeSet style(String fontName, int fontSize, boolean boldness, boolean italic, boolean strike, Color color, int leftIndent) {


        fontName = AlloyGraphics.matchBestFontName(fontName);

        MutableAttributeSet s = new SimpleAttributeSet();
        StyleConstants.setFontFamily(s, fontName);
        StyleConstants.setFontSize(s, fontSize);
        StyleConstants.setLineSpacing(s, -0.2f);
        StyleConstants.setBold(s, boldness);
        StyleConstants.setItalic(s, italic);
        StyleConstants.setForeground(s, color);
        StyleConstants.setLeftIndent(s, leftIndent);
        StyleConstants.setStrikeThrough(s, strike);
        return s;
    }
 
Example 7
Source File: StackTraceColorizer.java    From otroslogviewer with Apache License 2.0 6 votes vote down vote up
protected void initStyles() {
  styleContext = new StyleContext();
  Style defaultStyle = styleContext.getStyle(StyleContext.DEFAULT_STYLE);
  StyleConstants.setFontFamily(defaultStyle, "courier");
  styleStackTrace = styleContext.addStyle("stackTrace", defaultStyle);

  StyleConstants.setBackground(styleStackTrace, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_BACKGROUND));
  StyleConstants.setForeground(styleStackTrace, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_FOREGROUND));
  stylePackage = styleContext.addStyle("stylePackage", styleStackTrace);
  styleClass = styleContext.addStyle("styleClass", stylePackage);
  StyleConstants.setForeground(styleClass, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_CLASS));
  StyleConstants.setBold(styleClass, true);
  styleMethod = styleContext.addStyle("styleMethod", styleStackTrace);
  StyleConstants.setForeground(styleMethod, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_METHOD));
  StyleConstants.setItalic(styleMethod, true);
  StyleConstants.setBold(styleMethod, true);
  styleFile = styleContext.addStyle("styleFile", styleStackTrace);
  StyleConstants.setForeground(styleFile, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_FLE));
  StyleConstants.setUnderline(styleFile, true);

  styleCodeComment = styleContext.addStyle("styleCodeComment", defaultStyle);
  StyleConstants.setForeground(styleCodeComment, theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_COMMENT));
  StyleConstants.setItalic(styleCodeComment, true);
}
 
Example 8
Source File: Browser.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void setupStyle() {
  Document document = myHTMLViewer.getDocument();
  if (!(document instanceof StyledDocument)) {
    return;
  }

  StyledDocument styledDocument = (StyledDocument)document;

  EditorColorsManager colorsManager = EditorColorsManager.getInstance();
  EditorColorsScheme scheme = colorsManager.getGlobalScheme();

  Style style = styledDocument.addStyle("active", null);
  StyleConstants.setFontFamily(style, scheme.getEditorFontName());
  StyleConstants.setFontSize(style, scheme.getEditorFontSize());
  styledDocument.setCharacterAttributes(0, document.getLength(), style, false);
}
 
Example 9
Source File: SoapMessageColorizer.java    From otroslogviewer with Apache License 2.0 5 votes vote down vote up
private void initStyles() {
  StyleContext sc = new StyleContext();
  Style parent = sc.getStyle(StyleContext.DEFAULT_STYLE);

  StyleConstants.setFontFamily(parent, "courier");
  StyleConstants.setFontSize(parent, 13);

  styleElementName = sc.addStyle("elementName", parent);
  StyleConstants.setForeground(styleElementName, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ELEMENT_NAME));

  styleAttributeName = sc.addStyle("attributeName", parent);
  StyleConstants.setForeground(styleAttributeName, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ATTRIBUTE_NAME));

  styleAttributeValue = sc.addStyle("attributeValue", parent);
  StyleConstants.setForeground(styleAttributeValue, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_ATTRIBUTE_VALUE));

  styleContent = sc.addStyle("content", parent);
  StyleConstants.setBackground(styleContent, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CONTENT_BACKGROUND));
  StyleConstants.setForeground(styleContent, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CONTENT_FOREGROUND));

  styleOperator = sc.addStyle("operator", parent);
  StyleConstants.setForeground(styleOperator, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_OPERATOR));
  StyleConstants.setBold(styleOperator, true);

  styleComments = sc.addStyle("comments", parent);
  StyleConstants.setForeground(styleComments, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_COMMENTS));

  styleCData = sc.addStyle("cdata", parent);
  StyleConstants.setForeground(styleCData, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CDATA_FOREGROUND));
  StyleConstants.setBackground(styleCData, theme.getColor(ThemeKey.LOG_DETAILS_SOAP_CDATA_BACKGROUND));

  styleDOCTYPE = sc.addStyle("doctype", sc.addStyle("doctype", parent));
}
 
Example 10
Source File: DefenseCalculationSettingsPanel.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
/**
 * Creates new form AttackSourcePanel
 */
DefenseCalculationSettingsPanel() {
    initComponents();
    jXCollapsiblePane1.setLayout(new BorderLayout());
    jXCollapsiblePane1.add(jInfoScrollPane, BorderLayout.CENTER);
    jInfoTextPane.setText(GENERAL_INFO);
    StyledDocument doc = (StyledDocument) jTextPane1.getDocument();
    Style defaultStyle = doc.addStyle("Default", null);
    StyleConstants.setItalic(defaultStyle, true);
    StyleConstants.setFontFamily(defaultStyle, "SansSerif");
    dateFormat = new SimpleDateFormat("HH:mm:ss");
}
 
Example 11
Source File: MessagePanel.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a new MessagePanel object.
 */
public MessagePanel ()
{
    textPane.setEditable(false);
    textPane.setMargin(new Insets(5, 5, 5, 5));
    panel.setViewportView(textPane);

    // Font name & size
    StyleConstants.setFontFamily(attributes, LOG_FONT);
    StyleConstants.setFontSize(attributes, 10);
}
 
Example 12
Source File: SupportRefillCalculationPanel.java    From dsworkbench with Apache License 2.0 5 votes vote down vote up
/**
 * Creates new form AttackSourcePanel
 */
SupportRefillCalculationPanel() {
    initComponents();
    jXCollapsiblePane1.setLayout(new BorderLayout());
    jXCollapsiblePane1.add(jInfoScrollPane, BorderLayout.CENTER);
    jInfoTextPane.setText(GENERAL_INFO);
    StyledDocument doc = (StyledDocument) jTextPane1.getDocument();
    Style defaultStyle = doc.addStyle("Default", null);
    StyleConstants.setItalic(defaultStyle, true);
    StyleConstants.setFontFamily(defaultStyle, "SansSerif");
    dateFormat = new SimpleDateFormat("HH:mm:ss");
}
 
Example 13
Source File: JConsole.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private AttributeSet setStyle(
		String fontFamilyName, int size, Color color)
{
	final MutableAttributeSet attr = new SimpleAttributeSet();
	if (color != null)
		StyleConstants.setForeground(attr, color);
	if (fontFamilyName != null)
		StyleConstants.setFontFamily(attr, fontFamilyName);
	if (size != -1)
		StyleConstants.setFontSize(attr, size);

	setStyle(attr);

	return getStyle();
}
 
Example 14
Source File: JViewPortBackingStoreImageTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void createStyles() {
    styles = new StyleContext();
    doc = new DefaultStyledDocument(styles);
    contentAttributes = new HashMap<>();

    // no attributes defined
    Style s = styles.addStyle(null, null);
    contentAttributes.put("none", s);

    Style def = styles.getStyle(StyleContext.DEFAULT_STYLE);

    Style heading = styles.addStyle("heading", def);
    StyleConstants.setFontFamily(heading, "SansSerif");
    StyleConstants.setBold(heading, true);
    StyleConstants.setAlignment(heading, StyleConstants.ALIGN_CENTER);
    StyleConstants.setSpaceAbove(heading, 10);
    StyleConstants.setSpaceBelow(heading, 10);
    StyleConstants.setFontSize(heading, 18);

    // Title
    Style sty = styles.addStyle("title", heading);
    StyleConstants.setFontSize(sty, 32);

    // author
    sty = styles.addStyle("author", heading);
    StyleConstants.setItalic(sty, true);
    StyleConstants.setSpaceBelow(sty, 25);
}
 
Example 15
Source File: LogTextPanel.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
void setTextFontName(String name) {
  Enumeration e = fontAttributes.elements();
  while (e.hasMoreElements()) {
    StyleConstants.setFontFamily((MutableAttributeSet)e.nextElement(),name);
  }
  return;
}
 
Example 16
Source File: ExtendedStyledDocument.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Stores the given {@link String} line for the next batch update. If the number of elements
 * awaiting batch update are >= maxRows, will discard the oldest element. Call
 * {@link #executeBatch(int)} or {@link #executeBatchAppend()} to execute the batch update.
 * <p>
 * <strong>Attention:</strong> Every {@link String} is considered as one line so a line
 * separator will be added into the document after it.
 * </p>
 * <p>
 * This method is thread safe.
 * </p>
 *
 * @param str
 *            the {@link String} to add to the document.
 * @param a
 *            the style formatting settings
 */
public void appendLineForBatch(String str, SimpleAttributeSet a) {
	if (str == null || str.isEmpty()) {
		throw new IllegalArgumentException("str must not be null or empty!");
	}
	if (!str.endsWith(System.lineSeparator())) {
		str += System.lineSeparator();
	}

	char[] txt = str.toCharArray();
	a = a != null ? (SimpleAttributeSet) a.copyAttributes() : new SimpleAttributeSet();
	// set font family if not set
	if (a.getAttribute(StyleConstants.FontFamily) == null) {
		StyleConstants.setFontFamily(a, DEFAULT_FONT_FAMILY);
	}

	synchronized (LOCK) {
		// make sure batch size does not exceed maxRows *3 (*3 because we add the str and 2 line
		// separator tags)
		if (maxRows > 0) {
			while (listToInsert.size() >= maxRows * 3) {
				// remove element itself and both line separator elements)
				// we start at the beginning because we discard oldest first
				listToInsert.removeFirst();
				listToInsert.removeFirst();
				listToInsert.removeFirst();
				lineLength.removeFirst();
			}
		}

		// close previous paragraph tag, start new one, add text
		// yes the order is correct; no you cannot change to start/text/end
		// if you do, linebreaks get messed up
		listToInsert.add(new ElementSpec(new SimpleAttributeSet(), ElementSpec.EndTagType));
		listToInsert.add(new ElementSpec(new SimpleAttributeSet(), ElementSpec.StartTagType));
		listToInsert.add(new ElementSpec(a, ElementSpec.ContentType, txt, 0, txt.length));

		// store length of each row we add
		lineLength.add(txt.length);
	}
}
 
Example 17
Source File: StrategyCanvas.java    From iMetrica with GNU General Public License v3.0 4 votes vote down vote up
public void setIntroduction()
{  

   Style def = StyleContext.getDefaultStyleContext().
                      getStyle(StyleContext.DEFAULT_STYLE);  

   StyleConstants.setFontFamily(def, "SansSerif");

   StyleConstants.setAlignment(main_style, StyleConstants.ALIGN_LEFT);
   StyleConstants.setForeground(main_style, Color.green);
   try { doc.insertString(doc.getLength(), "Welcome to Evolution\n", main_style); }
   catch (BadLocationException e){}      
   
   
   
   
}
 
Example 18
Source File: LogDataFormatter.java    From otroslogviewer with Apache License 2.0 4 votes vote down vote up
public LogDataFormatter(OtrosApplication otrosApplication,
                        LogData logData, //
                        DateFormat dateFormat,//
                        MessageUpdateUtils messageUtils,//
                        PluginableElementsContainer<MessageColorizer> colorizersContainer,//
                        PluginableElementsContainer<MessageFormatter> formattersContainer,//
                        CancelStatus cancelStatus, int maximumMessageSize) {
  this.otrosApplication = otrosApplication;
  this.ld = logData;
  this.dateFormat = dateFormat;
  this.messageUtils = messageUtils;
  this.colorizersContainer = colorizersContainer;
  this.formattersContainer = formattersContainer;
  this.cancelStatus = cancelStatus;
  this.maximumMessageSize = maximumMessageSize;
  final Theme theme = otrosApplication.getTheme();

  sc = new StyleContext();
  Style defaultStyle = sc.getStyle(StyleContext.DEFAULT_STYLE);
  mainStyle = sc.addStyle("MainStyle", defaultStyle);
  StyleConstants.setForeground(mainStyle, theme.getColor(ThemeKey.LOG_DETAILS_DEFAULT));

  messageStyle = sc.addStyle("message", defaultStyle);
  StyleConstants.setForeground(messageStyle, theme.getColor(ThemeKey.LOG_DETAILS_MESSAGE));

  messageMonospacedStyle = sc.addStyle("messageMonospaced", messageStyle);
  StyleConstants.setFontFamily(messageMonospacedStyle, "monospaced");
  StyleConstants.setForeground(messageMonospacedStyle, theme.getColor(ThemeKey.LOG_DETAILS_MESSAGE));

  valueStyle = sc.addStyle("valueStyle", null);
  StyleConstants.setFontFamily(valueStyle, "monospaced");
  StyleConstants.setForeground(valueStyle, theme.getColor(ThemeKey.LOG_DETAILS_VALUE));

  propertyStyle = sc.addStyle("property", null);
  StyleConstants.setFontFamily(propertyStyle, "monospaced");
  StyleConstants.setForeground(propertyStyle, theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY));

  propertyNameStyle = sc.addStyle("propertyName", valueStyle);
  final Color propValueColor = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_KEY);
  StyleConstants.setForeground(propertyNameStyle, propValueColor);

  propertyValueStyle = sc.addStyle("propertyValue", valueStyle);
  final Color color = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_VALUE);
  StyleConstants.setForeground(propertyValueStyle, color);


}
 
Example 19
Source File: StyleProperties.java    From otroslogviewer with Apache License 2.0 4 votes vote down vote up
public static Style getStyle(Theme.Type themeType,StyleContext styleContext, DataConfiguration styleConfig, String styleName, int group) {
  Style style = styleContext.addStyle(styleName, styleContext.getStyle(StyleContext.DEFAULT_STYLE));

  final String groupSuffix;
  if (group <= 0) {
    groupSuffix = "";
  } else {
    groupSuffix = "." + group;
  }

  String fontFamily = styleConfig.getString(PROP_FONT_FAMILY + groupSuffix, "");
  if (fontFamily.trim().length() > 0) {
    StyleConstants.setFontFamily(style, styleConfig.getString(PROP_FONT_FAMILY + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_SIZE + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setFontSize(style, styleConfig.getInt(PROP_FONT_SIZE + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_BOLD + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setBold(style, styleConfig.getBoolean(PROP_FONT_BOLD + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_ITALIC + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setItalic(style, styleConfig.getBoolean(PROP_FONT_ITALIC + groupSuffix));
  }

  if (styleConfig.getString(PROP_FONT_UNDERLINE + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setUnderline(style, styleConfig.getBoolean(PROP_FONT_UNDERLINE + groupSuffix));
  }

  String theme;
  if (themeType.equals(Theme.Type.Light)) {
    theme = "light";
  } else {
    theme = "dark";
  }

  if (styleConfig.getString(PROP_BACKGROUND + groupSuffix + "." + theme,"").trim().length() > 0) {
    StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix + "." + theme, null));
  } else if (styleConfig.getString(PROP_BACKGROUND + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setBackground(style, styleConfig.getColor(PROP_BACKGROUND + groupSuffix));
  }

  if (styleConfig.getString(PROP_FOREGROUND + groupSuffix + "." + theme,"").trim().length() > 0) {
    StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix + "." + theme, null));
  } else if (styleConfig.getString(PROP_FOREGROUND + groupSuffix, "").trim().length() > 0) {
    StyleConstants.setForeground(style, styleConfig.getColor(PROP_FOREGROUND + groupSuffix));
  }

  return style;
}
 
Example 20
Source File: ViewPane.java    From aion-germany with GNU General Public License v3.0 4 votes vote down vote up
private void addStylesToHexDump(StyledDocument doc) {
	Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);

	Style base = doc.addStyle("base", def);
	StyleConstants.setFontFamily(base, "Monospaced");

	Style regular = doc.addStyle("regular", base);
	//StyleConstants.setUnderline(regular , true);

	Style s = doc.addStyle("d", regular);
	StyleConstants.setBackground(s, new Color(72, 164, 255));

	s = doc.addStyle("dbs", regular);
	StyleConstants.setBackground(s, new Color(72, 164, 255));

	s = doc.addStyle("Q", regular);
	StyleConstants.setBackground(s, new Color(255, 255, 128));

	s = doc.addStyle("h", regular);
	StyleConstants.setBackground(s, Color.ORANGE);

	s = doc.addStyle("hbs", regular);
	StyleConstants.setBackground(s, Color.ORANGE);

	s = doc.addStyle("s", regular);
	StyleConstants.setBackground(s, new Color(156, 220, 156));

	s = doc.addStyle("S", regular);
	StyleConstants.setBackground(s, new Color(156, 220, 156));

	s = doc.addStyle("c", regular);
	StyleConstants.setBackground(s, Color.PINK);

	s = doc.addStyle("cbs", regular);
	StyleConstants.setBackground(s, Color.PINK);

	s = doc.addStyle("f", regular);
	StyleConstants.setBackground(s, Color.LIGHT_GRAY);

	Color bxColor = new Color(255, 234, 213);
	s = doc.addStyle("b", regular);
	StyleConstants.setBackground(s, bxColor);
	s = doc.addStyle("x", regular);
	StyleConstants.setBackground(s, bxColor);

	s = doc.addStyle("op", regular);
	StyleConstants.setBackground(s, Color.YELLOW);

	s = doc.addStyle("selected", regular);
	StyleConstants.setBackground(s, Color.BLUE);

	s = doc.addStyle("chk", regular);
	StyleConstants.setBackground(s, Color.GREEN);
}