Search in sources :

Example 41 with Document

use of javax.swing.text.Document in project android-classyshark by google.

the class DisplayArea method displayError.

@Override
public void displayError() {
    displayDataState = DisplayDataState.ERROR;
    clearText();
    style = jTextPane.addStyle("STYLE", null);
    Document doc = jTextPane.getStyledDocument();
    try {
        StyleConstants.setForeground(style, theme.getDefaultColor());
        StyleConstants.setFontSize(style, 13);
        StyleConstants.setFontFamily(style, "Menlo");
        doc.insertString(doc.getLength(), "\n\n\n\t\t\t There was a problem loading the class  ", style);
        doc.insertString(doc.getLength(), Doodle.get(), style);
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
    jTextPane.setDocument(doc);
}
Also used : DefaultStyledDocument(javax.swing.text.DefaultStyledDocument) Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException)

Example 42 with Document

use of javax.swing.text.Document in project processing by processing.

the class DetailPanel method setSelectionStyle.

static void setSelectionStyle(JTextPane textPane, boolean selected) {
    Document doc = textPane.getDocument();
    if (doc instanceof HTMLDocument) {
        HTMLDocument html = (HTMLDocument) doc;
        StyleSheet styleSheet = html.getStyleSheet();
        if (selected) {
            styleSheet.addRule("a { text-decoration:underline } ");
        } else {
            styleSheet.addRule("a { text-decoration:none }");
        }
    }
}
Also used : StyleSheet(javax.swing.text.html.StyleSheet) HTMLDocument(javax.swing.text.html.HTMLDocument) HTMLDocument(javax.swing.text.html.HTMLDocument) Document(javax.swing.text.Document)

Example 43 with Document

use of javax.swing.text.Document in project enclojure by EricThorsen.

the class ClojureFoldManager method initFolds.

public void initFolds(FoldHierarchyTransaction tran) {
    Document doc = getOperation().getHierarchy().getComponent().getDocument();
    if (doc instanceof BaseDocument) {
        this.document = (BaseDocument) doc;
    }
    updateFolds(document, tran);
}
Also used : BaseDocument(org.netbeans.editor.BaseDocument) BaseDocument(org.netbeans.editor.BaseDocument) Document(javax.swing.text.Document)

Example 44 with Document

use of javax.swing.text.Document 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 45 with Document

use of javax.swing.text.Document 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)

Aggregations

Document (javax.swing.text.Document)72 BadLocationException (javax.swing.text.BadLocationException)35 DocumentEvent (javax.swing.event.DocumentEvent)10 DefaultStyledDocument (javax.swing.text.DefaultStyledDocument)8 DocumentAdapter (com.intellij.ui.DocumentAdapter)7 HTMLDocument (javax.swing.text.html.HTMLDocument)7 ActionEvent (java.awt.event.ActionEvent)5 PlainDocument (javax.swing.text.PlainDocument)5 ActionListener (java.awt.event.ActionListener)4 File (java.io.File)4 IOException (java.io.IOException)3 FieldPanel (com.intellij.ui.FieldPanel)2 CheckBox (com.intellij.util.ui.CheckBox)2 Color (java.awt.Color)2 NumberFormat (java.text.NumberFormat)2 ParseException (java.text.ParseException)2 AbstractAction (javax.swing.AbstractAction)2 DocumentListener (javax.swing.event.DocumentListener)2 AbstractDocument (javax.swing.text.AbstractDocument)2 Element (javax.swing.text.Element)2