Package markdowneditor

Source Code of markdowneditor.MarkdownPane

package markdowneditor;

import javax.swing.text.DefaultCaret;
import javax.swing.text.html.HTMLEditorKit;

public class MarkdownPane extends javax.swing.JTextPane {

  public void Init() {

    DefaultCaret caret = (DefaultCaret) getCaret();
    caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);

    HTMLEditorKit kit = new HTMLEditorKit();
    setEditorKit(kit);

    kit.getStyleSheet().addRule(""
        + "body {\n"
        + "  font-family: Helvetica, arial, freesans, clean, sans-serif;\n"
        + "  padding: 0px 10px;\n"
        + "}\n"
        + "\n"
        + "h2 {\n"
        + "  border-bottom: 1px solid;\n"
        + "}\n"
        + "\n"
        + "code, tt, pre {\n"
        + "  border: 1px solid;\n"
        + "}\n"
        + "\n"
        + "pre {\n"
        + "  padding: 5px 10px;\n"
        + "}\n"
        + "\n"
        + "blockquote {\n"
        + "  font-family: Times;\n"
        + "  font-style: italic;\n"
        + "  border: 1px solid;\n"
        + "  padding: 0px 15px;\n"
        + "}\n"
    );
  }
}
TOP

Related Classes of markdowneditor.MarkdownPane

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.