Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLEditorKit


    private boolean isPasswordModified() {
        return myPasswordModified;
    }

    private void initDebugTextPane() {
        HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
        HTMLDocument htmlDocument = new HTMLDocument();

        debugTextPane.setEditable(false);
        debugTextPane.setBackground(Color.WHITE);
        debugTextPane.setEditorKit(htmlEditorKit);
        htmlEditorKit.install(debugTextPane);
        debugTextPane.setDocument(htmlDocument);
    }
View Full Code Here


  /**
   * Creates a <code>EditorPaneLinkDetector</code>.
   */
  public EditorPaneLinkDetector() {

    HTMLEditorKit htmlkit = new HTMLEditorKit();

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

    ss.addStyleSheet(styles);

    ss.addRule("body {font-family:arial;font-size:12pt}");
View Full Code Here

  }

  static public void setHTMLEditorKit (JEditorPane editorPane) {
    editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
    // Extend all this shit to cache images.
    editorPane.setEditorKit(new HTMLEditorKit() {
      private static final long serialVersionUID = -54602188235105448L;

      public ViewFactory getViewFactory () {
        return new HTMLFactory() {
          public View create (Element elem) {
View Full Code Here

{

    public pamHelper(String resourceStr, String titleStr)
    {
        JEditorPane jep = new JEditorPane();
        EditorKit ek = new HTMLEditorKit();
        ek.install(jep);
        jep.setEditorKit(ek);
        try
        {
            jep.read(getClass().getResourceAsStream(resourceStr), "");
        }
View Full Code Here

 
  public NodeTooltip(){
    tip  = new JEditorPane();
    tip.setContentType("text/html");
    tip.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, false);
    final HTMLEditorKit kit = ScaledEditorKit.create();
    tip.setEditorKit(kit);
    tip.setEditable(false);
    tip.setMargin(new Insets(0, 0, 0, 0));
    final LinkMouseListener linkMouseListener = new LinkMouseListener();
    tip.addMouseListener(linkMouseListener);
View Full Code Here

    zoom = viewController.getZoom();
    if (zoom != 1F) {
      final float fontSize = (int) (Math.rint(font.getSize() * zoom));
      font = font.deriveFont(fontSize);
    }
    final HTMLEditorKit kit = new ScaledEditorKit(){
      @Override
      public void write(Writer out, Document doc, int pos, int len) throws IOException, BadLocationException {
        if (doc instanceof HTMLDocument) {
          HTMLWriter w = new SHTMLWriter(out, (HTMLDocument) doc, pos, len);
          w.write();
View Full Code Here

  }

  private String[] splitNode(final String text) {
    if (text.startsWith("<html>")) {
      String[] parts = null;
      final HTMLEditorKit kit = new HTMLEditorKit();
      final HTMLDocument doc = new HTMLDocument();
      final StringReader buf = new StringReader(text);
      try {
        kit.read(buf, doc, 0);
        final Element parent = getParentElement(doc);
        if (parent == null) {
          return null;
        }
        final int elementCount = parent.getElementCount();
View Full Code Here

    if (pos <= 0) {
      return null;
    }
    final String[] strings = new String[2];
    if (text.startsWith("<html>")) {
      final HTMLEditorKit kit = new HTMLEditorKit();
      final HTMLDocument doc = new HTMLDocument();
      final StringReader buf = new StringReader(text);
      try {
        kit.read(buf, doc, 0);
        final char[] firstText = doc.getText(0, pos).toCharArray();
        int firstStart = 0;
        int firstLen = pos;
        while ((firstStart < firstLen) && (firstText[firstStart] <= ' ')) {
          firstStart++;
View Full Code Here

      }
    }

    private TextFragment[] split(final String text) {
      final LinkedList<TextFragment> htmlFragments = new LinkedList<TextFragment>();
      final HTMLEditorKit kit = new HTMLEditorKit();
      final HTMLDocument doc = new HTMLDocument();
      final StringReader buf = new StringReader(text);
      try {
        kit.read(buf, doc, 0);
        final Element parent = getParentElement(doc);
        split(doc, parent, htmlFragments, 0);
      }
      catch (final IOException e) {
        LogUtils.severe(e);
View Full Code Here

   *            HTML source
   * @param writer
   *            XHTML target
   */
  public static void html2xhtml(final Reader reader, final Writer writer) throws IOException, BadLocationException {
    final HTMLEditorKit kit = new HTMLEditorKit();
    final Document doc = kit.createDefaultDocument();
    kit.read(reader, doc, doc.getLength());
    final XHTMLWriter xhw = new XHTMLWriter(writer, (HTMLDocument) doc);
    xhw.write();
  }
View Full Code Here

TOP

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

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.