Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLDocument


    public static void setEditorFont(JEditorPane editor, Font font)
    {
        Document document = editor.getDocument();
        if (document instanceof HTMLDocument)
        {
            HTMLDocument htmlDocument = (HTMLDocument)document;

            String css = "body { font: normal " + font.getSize() + "pt " + font.getFamily() + " }";
            loadStyles(htmlDocument, css);
        }
    }
View Full Code Here


        String releaseType = ApplicationLauncher.getReleaseType();
        String version = Application.getDescription().getVersion() +
            (releaseType == null ? "" : " " + releaseType);
        html = PATTERN_VERSION.matcher(html).replaceAll(version);

        HTMLDocument doc = (HTMLDocument)text.getDocument();
        doc.setBase(aboutTextURL);
    }
View Full Code Here

        Color back = taDescription.getBackground();
        taDescription.setEditable(false);
        taDescription.setBackground(back);
        taDescription.setEditorKit(new CustomHTMLEditorKit());

        HTMLDocument doc = (HTMLDocument)taDescription.getDocument();
        Style def = doc.getStyle("default");
        Font font = UIManager.getFont("TextArea.font");
        if (SystemUtils.IS_OS_MAC) font = UifUtilities.applyFontBias(font, -2);
        UifUtilities.setFontAttributes(doc.addStyle(TEXT_STYLE, def), font);

        builder = new BBFormBuilder("0:grow");
        builder.appendUnrelatedComponentsGapRow(2);
        builder.appendRow("p");
View Full Code Here

        StyleSheet styles = getStyleSheet();
        StyleSheet ss = new StyleSheet();

        ss.addStyleSheet(styles);

        HTMLDocument doc = new CustomHTMLDocument(ss);
        doc.setParser(getParser());
        doc.setAsynchronousLoadPriority(4);
        doc.setTokenThreshold(100);
        return doc;
    }
View Full Code Here

     * Convenience method to get the StyleSheet.
     * @return stylesheet.
     */
    protected StyleSheet getStyleSheet()
    {
        HTMLDocument doc = (HTMLDocument)getDocument();
        return doc.getStyleSheet();
    }
View Full Code Here

        tfText.setEditorKit(new CustomHTMLEditorKit());
        tfText.setText(StringUtils.excerpt(aText, EXCERPT_SENTENCES, EXCERPT_MIN_CHARS, EXCERPT_MAX_CHARS));
        tfText.setEditable(false);
        tfText.setToolTipText("<html>" + aText);

        HTMLDocument doc = (HTMLDocument)tfText.getDocument();
        doc.setBase(article.getLink());
        Style def = doc.getStyle("default");
        doc.addStyle(TEXT_STYLE_NAME, def);
        UifUtilities.setFontAttributes(doc, TEXT_STYLE_NAME, articleConfig.getTextFont());

        setViewMode(config.getViewMode());

        layout = new FormLayout("5px, center:pref, 5px", "5px, pref, 5px, pref, 5px, pref, 5px");
View Full Code Here

        Font font = cnf.getTitleFont(article.isRead());
        lbTitle.setFont(font);

        // Text area
        font = cnf.getTextFont();
        HTMLDocument doc = (HTMLDocument)tfText.getDocument();
        UifUtilities.setFontAttributes(doc, TEXT_STYLE_NAME, font);
        UifUtilities.installTextStyle(tfText, TEXT_STYLE_NAME);

        doLayout();
    }
View Full Code Here

     * Invoked when highlights should be repainted.
     */
    public void updateHighlights()
    {
        String text = getText(tpText);
        HTMLDocument doc = (HTMLDocument)tpText.getDocument();

        UpdateHighlights task = new UpdateHighlights(text, doc);
        executor.execute(task);
    }
View Full Code Here

    private void updateForegrounds()
    {
        Color titleColor = config.getTitleFGColor(selected);
        Color dateColor = config.getDateFGColor(selected);

        HTMLDocument doc = (HTMLDocument)tpText.getDocument();
        UifUtilities.setTextColor(doc, TEXT_STYLE_NAME, config.getTextColor(selected));
        UifUtilities.installTextStyle(tpText, TEXT_STYLE_NAME);

        lbTitle.setForeground(titleColor);
        if (lbDate != null) lbDate.setForeground(dateColor);
View Full Code Here

            lbFeedTitle.setFont(config.getDateFont());
        }
        if (lbCategories != null) lbCategories.setFont(config.getDateFont());
        if (lbURL != null) lbURL.setFont(config.getDateFont());

        HTMLDocument doc = (HTMLDocument)tpText.getDocument();
        UifUtilities.setFontAttributes(doc, TEXT_STYLE_NAME, config.getTextFont());
        UifUtilities.installTextStyle(tpText, TEXT_STYLE_NAME);

        rescaleTitle();
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.html.HTMLDocument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.