use of javax.swing.text.Style in project jabref by JabRef.
the class BasicAction method addStylesToDocument.
private void addStylesToDocument() {
//Initialize some styles.
Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
Style regularStyle = document.addStyle("regular", defaultStyle);
StyleConstants.setFontFamily(defaultStyle, "SansSerif");
StyleConstants.setFontSize(defaultStyle, Globals.prefs.getInt(JabRefPreferences.FONT_SIZE));
Style s = document.addStyle("used", regularStyle);
StyleConstants.setBold(s, true);
StyleConstants.setForeground(s, Color.blue);
s = document.addStyle("marked", regularStyle);
StyleConstants.setBold(s, true);
StyleConstants.setForeground(s, Color.red);
}
use of javax.swing.text.Style in project binnavi by google.
the class BaseTypeTableCellRenderer method createDeclarationStyle.
private static Style createDeclarationStyle(final StyledDocument document) {
final Style declStyle = document.addStyle("DECL_STYLE", null);
StyleConstants.setBackground(declStyle, Color.WHITE);
StyleConstants.setForeground(declStyle, Color.BLACK);
StyleConstants.setFontFamily(declStyle, GuiHelper.getMonospaceFont());
StyleConstants.setFontSize(declStyle, 11);
return declStyle;
}
use of javax.swing.text.Style in project binnavi by google.
the class BaseTypeTableCellRenderer method renderAtomic.
private static void renderAtomic(final TypeInstance instance, final StyledDocument document, final boolean renderData) {
final Style atomicStyle = createDeclarationStyle(document);
try {
document.remove(0, document.getLength());
final BaseType baseType = instance.getBaseType();
appendString(document, baseType.getName(), atomicStyle);
if (renderData) {
appendString(document, renderInstanceData(baseType, instance.getAddress().getOffset(), instance.getSection()), createDataStyle(document));
}
} catch (final BadLocationException exception) {
CUtilityFunctions.logException(exception);
}
}
use of javax.swing.text.Style in project binnavi by google.
the class BaseTypeTableCellRenderer method renderPointer.
private static void renderPointer(final TypeInstance instance, final StyledDocument document) {
final Style pointerStyle = createDeclarationStyle(document);
try {
document.remove(0, document.getLength());
appendString(document, instance.getBaseType().getName(), pointerStyle);
} catch (final BadLocationException exception) {
CUtilityFunctions.logException(exception);
}
}
use of javax.swing.text.Style in project binnavi by google.
the class BaseTypeTableCellRenderer method renderArray.
private static void renderArray(final TypeInstance instance, final StyledDocument document, final boolean renderData) {
final Style arrayStyle = createDeclarationStyle(document);
try {
document.remove(0, document.getLength());
final BaseType baseType = instance.getBaseType();
appendString(document, baseType.getName(), arrayStyle);
if (renderData) {
appendString(document, renderInstanceData(baseType, instance.getAddress().getOffset(), instance.getSection()), createDataStyle(document));
}
} catch (final BadLocationException exception) {
CUtilityFunctions.logException(exception);
}
}
Aggregations