Search in sources :

Example 6 with Style

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);
}
Also used : Style(javax.swing.text.Style)

Example 7 with Style

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;
}
Also used : Style(javax.swing.text.Style)

Example 8 with Style

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);
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) Style(javax.swing.text.Style) BadLocationException(javax.swing.text.BadLocationException)

Example 9 with Style

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);
    }
}
Also used : Style(javax.swing.text.Style) BadLocationException(javax.swing.text.BadLocationException)

Example 10 with Style

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);
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) Style(javax.swing.text.Style) BadLocationException(javax.swing.text.BadLocationException)

Aggregations

Style (javax.swing.text.Style)16 BadLocationException (javax.swing.text.BadLocationException)5 StyledDocument (javax.swing.text.StyledDocument)4 BaseType (com.google.security.zynamics.binnavi.disassembly.types.BaseType)3 HTMLDocument (javax.swing.text.html.HTMLDocument)3 StyleContext (javax.swing.text.StyleContext)2 TypeMember (com.google.security.zynamics.binnavi.disassembly.types.TypeMember)1 LoadingNode (com.intellij.ui.LoadingNode)1 BorderLayout (java.awt.BorderLayout)1 Date (java.util.Date)1 Entry (java.util.Map.Entry)1 JPanel (javax.swing.JPanel)1 JSplitPane (javax.swing.JSplitPane)1 JTabbedPane (javax.swing.JTabbedPane)1 JTable (javax.swing.JTable)1 JTextPane (javax.swing.JTextPane)1 AttributeSet (javax.swing.text.AttributeSet)1 SimpleAttributeSet (javax.swing.text.SimpleAttributeSet)1 StyleSheet (javax.swing.text.html.StyleSheet)1 AssertionResult (org.apache.jmeter.assertions.AssertionResult)1