Package javax.swing.text.html

Examples of javax.swing.text.html.StyleSheet.addRule()


        Font font = UIManager.getFont("Label.font");
        StyleSheet css = ((HTMLDocument)getDocument()).getStyleSheet();
        setOpaque(false);

        css.addRule("body {color : #" + getHexValue(UIManager.getColor("Label.foreground")) + " }");
        css.addRule("body {font-size : " + font.getSize() + "pt; }");
        css.addRule("body {font-family :" + font.getFontName() + "; }");
        setInverted(false);

        if (text != null) {
            setText(text);
View Full Code Here


        StyleSheet css = ((HTMLDocument)getDocument()).getStyleSheet();
        setOpaque(false);

        css.addRule("body {color : #" + getHexValue(UIManager.getColor("Label.foreground")) + " }");
        css.addRule("body {font-size : " + font.getSize() + "pt; }");
        css.addRule("body {font-family :" + font.getFontName() + "; }");
        setInverted(false);

        if (text != null) {
            setText(text);
        }
View Full Code Here

    public void setInverted(boolean inverted) {
        Document document = getDocument();
        if (document instanceof HTMLDocument) {
            HTMLDocument htmlDocument = (HTMLDocument)document;
            StyleSheet css = htmlDocument.getStyleSheet();
            css.addRule("a {color : #" + getHexValue(inverted ? getForeground() : COLOR_LINK) + " }");
            css.addRule("a:active {color : #" + getHexValue(inverted ? getForeground() : COLOR_LINK) + " }");
        }
    }

    @Override
View Full Code Here

        Document document = getDocument();
        if (document instanceof HTMLDocument) {
            HTMLDocument htmlDocument = (HTMLDocument)document;
            StyleSheet css = htmlDocument.getStyleSheet();
            css.addRule("a {color : #" + getHexValue(inverted ? getForeground() : COLOR_LINK) + " }");
            css.addRule("a:active {color : #" + getHexValue(inverted ? getForeground() : COLOR_LINK) + " }");
        }
    }

    @Override
    public Dimension getMinimumSize() {
View Full Code Here

        super.setForeground(fg);
        Document document = getDocument();
        if (document instanceof HTMLDocument) {
            HTMLDocument htmlDocument = (HTMLDocument)document;
            StyleSheet css = htmlDocument.getStyleSheet();
            css.addRule("body {color : #" + getHexValue(fg) + " }");
        }
    }

    private String getHexValue(Color color) {
        StringBuilder buffer = new StringBuilder();
View Full Code Here

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

    ss.addStyleSheet(styles);

    ss.addRule("body {font-family:arial;font-size:12pt}");
    ss.addRule("p {font-family:arial;margin:2}");

    HTMLDocument doc = new HTMLDocLinkDetector(ss);

    setEditorKit(htmlkit);
View Full Code Here

    StyleSheet ss = new StyleSheet();

    ss.addStyleSheet(styles);

    ss.addRule("body {font-family:arial;font-size:12pt}");
    ss.addRule("p {font-family:arial;margin:2}");

    HTMLDocument doc = new HTMLDocLinkDetector(ss);

    setEditorKit(htmlkit);
View Full Code Here

        } catch (Exception e) {
            Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
            Main.error(e);
            return ss;
        }
        ss.addRule(css.toString());
        return ss;
    }

    protected JToolBar buildToolBar() {
        JToolBar tb = new JToolBar();
View Full Code Here

        adaptForNimbus(pane);

        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
        final Font f = UIManager.getFont("Label.font");
        final StyleSheet ss = new StyleSheet();
        ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + "}");
        ss.addRule("a {text-decoration: underline; color: blue}");
        ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + "}");
        ss.addRule("ol {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: decimal}");
        ss.addRule("ul {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: disc}");
        kit.setStyleSheet(ss);
View Full Code Here

        JosmHTMLEditorKit kit = new JosmHTMLEditorKit();
        final Font f = UIManager.getFont("Label.font");
        final StyleSheet ss = new StyleSheet();
        ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + "}");
        ss.addRule("a {text-decoration: underline; color: blue}");
        ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + "}");
        ss.addRule("ol {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: decimal}");
        ss.addRule("ul {margin-left: 1cm; margin-top: 0.1cm; margin-bottom: 0.2cm; list-style-type: disc}");
        kit.setStyleSheet(ss);
        pane.setEditorKit(kit);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.