Search in sources :

Example 46 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 ignored) {
        }
    }
    getContentPane().validate();
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException)

Example 47 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 ignored) {
        }
    }
    validate();
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException)

Example 48 with SimpleAttributeSet

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

the class ChatPane method onWhisper.

public void onWhisper(MessageWrapper m) {
    SimpleAttributeSet senderSet, receiverSet;
    long sender = m.getLocal().getSenderID();
    String receiver = (String) m.getLocal().getExtra();
    print(m, "\n" + getTime(), GUIMain.norm);
    User senderUser = Settings.channelManager.getUser(sender, true);
    User receiverUser = Settings.channelManager.getUser(receiver, true);
    senderSet = getUserSet(senderUser);
    receiverSet = getUserSet(receiverUser);
    // name stuff
    print(m, " ", GUIMain.norm);
    FaceManager.handleNameFaces(senderUser.getUserID(), senderSet);
    FaceManager.handleNameFaces(receiverUser.getUserID(), receiverSet);
    print(m, senderUser.getDisplayName(), senderSet);
    print(m, " (whisper)-> ", GUIMain.norm);
    print(m, receiverUser.getDisplayName(), receiverSet);
    print(m, ": ", GUIMain.norm);
    printMessage(m, m.getLocal().getContent(), GUIMain.norm, senderUser);
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet) User(lib.pircbot.User)

Example 49 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)

Example 50 with SimpleAttributeSet

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

the class ChatPane method getUserSet.

private SimpleAttributeSet getUserSet(User u) {
    SimpleAttributeSet user = new SimpleAttributeSet();
    StyleConstants.setFontFamily(user, Settings.font.getValue().getFamily());
    StyleConstants.setFontSize(user, Settings.font.getValue().getSize());
    StyleConstants.setForeground(user, Utils.getColorFromUser(u));
    user.addAttribute(HTML.Attribute.NAME, u.getDisplayName());
    return user;
}
Also used : SimpleAttributeSet(javax.swing.text.SimpleAttributeSet)

Aggregations

SimpleAttributeSet (javax.swing.text.SimpleAttributeSet)57 StyledDocument (javax.swing.text.StyledDocument)10 BadLocationException (javax.swing.text.BadLocationException)7 MutableAttributeSet (javax.swing.text.MutableAttributeSet)7 HTMLDocument (javax.swing.text.html.HTMLDocument)5 Color (java.awt.Color)3 AttributeSet (javax.swing.text.AttributeSet)3 View (javax.swing.text.View)3 HTML (javax.swing.text.html.HTML)3 User (lib.pircbot.User)3 Font (java.awt.Font)2 URL (java.net.URL)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 Document (javax.swing.text.Document)2 Test (org.junit.Test)2 TaskCallbackStatus (cbit.vcell.mapping.TaskCallbackMessage.TaskCallbackStatus)1 ColorSet (com.android.tools.sherpa.drawing.ColorSet)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 Project (com.intellij.openapi.project.Project)1