Package javax.swing.text.html

Examples of javax.swing.text.html.StyleSheet


             * Overriden to return our own slimmed down style sheet.
             */
            @Override
            public StyleSheet getStyleSheet() {
                if (defaultStyles == null) {
                defaultStyles = new StyleSheet();
                StringReader r = new StringReader(styleChanges);
                try {
                    defaultStyles.loadRules(r, null);
                } catch (Throwable e) {
                    // don't want to die in static initialization...
View Full Code Here


         * Sets the async policy to flush everything in one chunk, and
         * to not display unknown tags.
         */
        public Document createDefaultDocument(Font defaultFont,
                                                  Color foreground) {
            StyleSheet styles = getStyleSheet();
            StyleSheet ss = new StyleSheet();
            ss.addStyleSheet(styles);
            BasicDocument doc = new BasicDocument(ss, defaultFont, foreground);
            doc.setAsynchronousLoadPriority(Integer.MAX_VALUE);
            doc.setPreservesUnknownTags(false);
            return doc;
        }
View Full Code Here

        return smileMap;
    }

    public static void setCSSRule(HTMLEditorKit htmlKit) {
        StyleSheet css = new StyleSheet();
        css.addRule("body {"
                + "text-align:center;"
                + "}");
        css.addRule("p {"
                + "font-family: Sans, Georgia, serif; "
                + "font-size: 11pt;"
                + "text-align:justify;"
                + "}");
        css.addRule("span { "
                + "font-size: 8px;"
                + "font-family: Sans; "
                + "color: #808080;"
                + "}");
        css.addRule("#nick {"
                + "font-family: Sans, Georgia, serif; "
                + "font-size: 11pt;"
                + "text-align:justify;"
                + "}");
        css.addRule("#connect { "
                + "display: block;"
                + "-moz-border-radius: 5px;"
                + "border-radius: 5px;"
                + "border-width: 1px;"
                + "border-style: solid;"
                + "border-color: #9bac55;"
                + "padding: 5px;"
                + "background-color: #e5f993;"
                + "margin-right: 3;"
                + "margin-left: 3;"
                + "margin-top: 3;"
                + "text-align:center;"
                + "}");
        css.addRule("#disconnect { "
                + "display: block;"
                + "border-width: 1px;"
                + "border-style: solid;"
                + "border-color: #90b1c7;"
                + "padding: 5px;"
                + "background-color: #fbe0e0;"
                + "margin-right: 3;"
                + "margin-left: 3;"
                + "margin-top: 3;"
                + "text-align:center;"
                + "}");
        css.addRule("#warning { "
                + "display: block;"
                + "border-width: 1px;"
                + "border-style: solid;"
                + "border-color: #c2beb1;"
                + "padding: 5px;"
                + "background-color: #fffcd3;"
                + "margin-right: 3;"
                + "margin-left: 3;"
                + "margin-top: 3;"
                + "text-align:center;"
                + "}");
        css.addRule("#success { "
                + "display: block;"
                + "border-width: 1px;"
                + "border-style: solid;"
                + "border-color: #ffffff;"
                + "padding: 5px;"
View Full Code Here

                            "suggested=" + StyleSheet.class.getName() + "; got=" + obj.getClass().getName());
                } else {
                    return (StyleSheet) obj;
                }
            } else {
                StyleSheet sheet = new StyleSheet();
                Reader reader = new InputStreamReader(System.class.getResourceAsStream("/assets/css/" + name + ".css"));
                sheet.loadRules(reader, null);
                reader.close();

                resources.put(name, sheet);
                return sheet;
            }
View Full Code Here

            }
        });

        // Setup the editor pane for rendering HTML.
        final HTMLEditorKit kit = new MarkdownEditorKit(document);
        final StyleSheet style = new StyleSheet();
        style.importStyleSheet(MarkdownPreviewEditor.class.getResource(PREVIEW_STYLESHEET_PATH));
        kit.setStyleSheet(style);
        jEditorPane.setEditorKit(kit);
        jEditorPane.setEditable(false);

        // Set the editor pane position to top left, and do not let it reset it
View Full Code Here

     * @see javax.swing.text.EditorKit#createDefaultDocument()
     */
    @Override
    public Document createDefaultDocument() {
       
        StyleSheet styles = getStyleSheet();
        NavHtmlDocument doc = new NavHtmlDocument(styles);

        doc.setParser(getParser());
        doc.setAsynchronousLoadPriority(4);
        doc.setTokenThreshold(100);
View Full Code Here

    Font font = getLabelFont();
    @NonNls String family = font != null ? font.getFamily() : "Tahoma";
    int size = font != null ? font.getSize() : 11;

    final StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule(String.format("body, div, p { font-family: %s; font-size: %s; } p { margin-top: 0; }", family, size));
    kit.setStyleSheet(styleSheet);

    return kit;
  }
View Full Code Here

    private String _path2 = "";

    public ApitTreeUI() {
        initComponents();
        HTMLEditorKit hed = new HTMLEditorKit();
        StyleSheet sheet = hed.getStyleSheet();

        sheet.addRule(".php-boundry {font-weight:bold;}");
        sheet.addRule(".php-function-or-constant {color:#0000AA; }");
        sheet.addRule(".php-string {color:#AA0000; }");
        sheet.addRule(".php-constant {color:#AA3333; }");
        sheet.addRule(".php-variable {color:#333300; }");
        sheet.addRule(".php-keyword {color:#006600; }");
        sheet.addRule("pre {background-color: #F6F6F2; white-space:pre-wrap;}");
        sheet.addRule(".code {background-color: #F6F6F2; white-space:pre-wrap;margin-bottom:5px;margin-top:5px;}");
        sheet.addRule(".code p{margin-left:5px}");
        Document doc = hed.createDefaultDocument();
        txtHelp.setEditorKit(hed);
        tree.setModel(treeModel);
        tree.setModel(treeModel);
        tree.setCellRenderer(new TreeRenderer());
View Full Code Here

        textArea.setContentType("text/html");
        textArea.setEditorKit(HTMLkit);
        textArea.setDocument(HTMLdoc);
        HyperlinkListener hyperlinkListener = new ActivatedHyperlinkListener(textArea);
        textArea.addHyperlinkListener(hyperlinkListener);
        StyleSheet sheet = HTMLkit.getStyleSheet();

        JScrollPane scroller = new JScrollPane(textArea);
        add(scroller, BorderLayout.CENTER);
        addPopupMenu();
        setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
View Full Code Here

    */
  public RelativeImageView(Element elem)
  {
    super(elem);
    initialize(elem);
    StyleSheet sheet = getStyleSheet();
    attr = sheet.getViewAttributes(this);
  }
View Full Code Here

TOP

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

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.