Search in sources :

Example 11 with SimpleAttributeSet

use of javax.swing.text.SimpleAttributeSet in project JMRI by JMRI.

the class JTextPaneAppender method createAttributes.

private void createAttributes() {
    String[] prio = new String[6];
    prio[0] = Level.FATAL.toString();
    prio[1] = Level.ERROR.toString();
    prio[2] = Level.WARN.toString();
    prio[3] = Level.INFO.toString();
    prio[4] = Level.DEBUG.toString();
    prio[5] = Level.TRACE.toString();
    myAttributeSet = new Hashtable<String, MutableAttributeSet>();
    for (int i = 0; i < prio.length; i++) {
        MutableAttributeSet att = new SimpleAttributeSet();
        myAttributeSet.put(prio[i], att);
        StyleConstants.setFontSize(att, 14);
    }
    StyleConstants.setForeground(myAttributeSet.get(Level.FATAL.toString()), Color.red);
    StyleConstants.setForeground(myAttributeSet.get(Level.ERROR.toString()), Color.red);
    StyleConstants.setForeground(myAttributeSet.get(Level.WARN.toString()), Color.orange);
    StyleConstants.setForeground(myAttributeSet.get(Level.INFO.toString()), Color.black);
    StyleConstants.setForeground(myAttributeSet.get(Level.DEBUG.toString()), Color.black);
    StyleConstants.setForeground(myAttributeSet.get(Level.TRACE.toString()), Color.black);
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) MutableAttributeSet(javax.swing.text.MutableAttributeSet)

Example 12 with SimpleAttributeSet

use of javax.swing.text.SimpleAttributeSet in project antlrworks by antlr.

the class DBInputProcessorToken method createTextAttributes.

public void createTextAttributes() {
    attributeNonConsumed = new SimpleAttributeSet();
    StyleConstants.setForeground(attributeNonConsumed, AWPrefs.getNonConsumedTokenColor());
    attributeConsume = new SimpleAttributeSet();
    StyleConstants.setForeground(attributeConsume, AWPrefs.getConsumedTokenColor());
    attributeConsumeHidden = new SimpleAttributeSet();
    StyleConstants.setForeground(attributeConsumeHidden, AWPrefs.getHiddenTokenColor());
    attributeConsumeDead = new SimpleAttributeSet();
    StyleConstants.setForeground(attributeConsumeDead, AWPrefs.getDeadTokenColor());
    attributeLookahead = new SimpleAttributeSet();
    StyleConstants.setForeground(attributeLookahead, AWPrefs.getLookaheadTokenColor());
    StyleConstants.setItalic(attributeLookahead, true);
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet)

Example 13 with SimpleAttributeSet

use of javax.swing.text.SimpleAttributeSet in project LogisticsPipes by RS485.

the class LogWindow method newLine.

public void newLine(String data) {
    SimpleAttributeSet attr = new SimpleAttributeSet();
    StyleConstants.setFontFamily(attr, "SansSerif");
    StyleConstants.setFontSize(attr, 12);
    // StyleConstants.setForeground(attr, color);
    Document document = logArea.getDocument();
    if (document != null) {
        try {
            document.insertString(document.getLength(), data + "\n", attr);
        } catch (BadLocationException badlocationexception) {
        }
    }
    validate();
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException)

Example 14 with SimpleAttributeSet

use of javax.swing.text.SimpleAttributeSet in project LogisticsPipes by RS485.

the class DebugWindow method showInfo.

public void showInfo(String data, Color color) {
    SimpleAttributeSet attr = new SimpleAttributeSet();
    StyleConstants.setFontFamily(attr, "SansSerif");
    StyleConstants.setFontSize(attr, 12);
    StyleConstants.setForeground(attr, color);
    Document document = textArea.getDocument();
    if (document != null) {
        try {
            document.insertString(document.getLength(), data, attr);
        } catch (BadLocationException badlocationexception) {
        }
    }
    getContentPane().validate();
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException)

Example 15 with SimpleAttributeSet

use of javax.swing.text.SimpleAttributeSet in project Botnak by Gocnak.

the class ChatPane method insertIcon.

public void insertIcon(MessageWrapper m, IconEnum type, String channel) {
    SimpleAttributeSet attrs = new SimpleAttributeSet();
    Icons.BotnakIcon icon = Icons.getIcon(type, channel);
    StyleConstants.setIcon(attrs, icon.getImage());
    try {
        print(m, " ", null);
        print(m, icon.getType().type, attrs);
    } catch (Exception e) {
        GUIMain.log("Exception in insertIcon: ");
        GUIMain.log(e);
    }
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) Icons(face.Icons)

Aggregations

SimpleAttributeSet (javax.swing.text.SimpleAttributeSet)28 StyledDocument (javax.swing.text.StyledDocument)5 AttributeSet (javax.swing.text.AttributeSet)3 BadLocationException (javax.swing.text.BadLocationException)3 HTML (javax.swing.text.html.HTML)3 User (lib.pircbot.User)3 URL (java.net.URL)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 Document (javax.swing.text.Document)2 HTMLDocument (javax.swing.text.html.HTMLDocument)2 ColorSet (com.android.tools.sherpa.drawing.ColorSet)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)1 Icons (face.Icons)1 ChatPane (gui.ChatPane)1 CombinedChatPane (gui.CombinedChatPane)1 GUIMain (gui.forms.GUIMain)1