Examples of insertHTML()


Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

          {
            HTMLEditorKit editorKit = new HTMLEditorKit();
            HTMLDocument document = (HTMLDocument) editorPane
                .getDocument();
            document.remove(start, (ende - start));
            editorKit.insertHTML(document, start, ((bold) ? "<b>"
                : "<i>") + text + ((bold) ? "</b>" : "</i>"),
                0, 0, (bold) ? HTML.Tag.B : HTML.Tag.I);
          }
          catch (Exception ex)
          {
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

     */
    public void error(String s) {
  HTMLDocument doc = (HTMLDocument) getDocument();
  HTMLEditorKit kit = (HTMLEditorKit) getEditorKit();
  try {
      kit.insertHTML(doc, doc.getLength(),
        "<font color=#CC0000><b> " + s + "<b><br></font>",
        0, 0, HTML.Tag.FONT);
      setCaretPosition(doc.getLength());
  } catch (Throwable t) {
  }
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

  s = replaceImage(":o", s, capp.getOhPath());
  s = replaceImage(":\\?", s, capp.getQuestionPath());
 
  String msg = sender + pvt + s;
  try {
      kit.insertHTML(doc, doc.getLength(), msg,
        0, 0, HTML.Tag.FONT);
      setCaretPosition(doc.getLength());
      capp.playRecieveSound();
  } catch (Throwable t) {
  }
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

 
  public void addLine(String line) {
    HTMLDocument chatDocument = (HTMLDocument) chatArea.getDocument();
    HTMLEditorKit chatKit = (HTMLEditorKit) chatArea.getEditorKit();
    try {
      chatKit.insertHTML(chatDocument, chatDocument.getLength(), line, 0, 0, null);
    } catch (BadLocationException | IOException e) {
      e.printStackTrace();
    }
    chatArea.setCaretPosition(chatArea.getDocument().getLength());
  }
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

            HTMLEditorKit kit = (HTMLEditorKit)editor.getEditorKit();
            try
            {
                htmlDocument.remove(offset, editor.getSelectionEnd() - offset);
                kit.insertHTML(htmlDocument, offset, txt, 0, 0, HTML.Tag.A);
            } catch (Throwable e)
            {
                LOG.log(Level.WARNING, "Failed to insert link", e);
            }
        } else
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

          {
            HTMLEditorKit editorKit = new HTMLEditorKit();
            HTMLDocument document = (HTMLDocument) editorPane
                .getDocument();
            document.remove(start, (ende - start));
            editorKit.insertHTML(document, start, ((bold) ? "<b>"
                : "<i>") + text + ((bold) ? "</b>" : "</i>"),
                0, 0, (bold) ? HTML.Tag.B : HTML.Tag.I);
          }
          catch (Exception ex)
          {
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

  public static void appendToTextPane(JTextPane pane, String s) {
    HTMLDocument doc = (HTMLDocument) pane.getDocument();
    HTMLEditorKit kit = (HTMLEditorKit) pane.getEditorKit();

    try {
      kit.insertHTML(doc, doc.getLength(), s, 0, 0, null);
    } catch (BadLocationException e) {
    } catch (IOException e) {
    }
  }
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

                                            byte[] imageData = baos.toByteArray();
                                            String encoded = SimpleBase64.encode(imageData);
                                           
                                            HTMLEditorKit kit = (HTMLEditorKit)jtpMain.getEditorKit();
                                            HTMLDocument d = (HTMLDocument)jtpMain.getDocument();
                                            kit.insertHTML(d,jtpMain.getCaretPosition(),"<img src=\"data:image/x-png;base64," + encoded  + "\" />",0,0,HTML.Tag.IMG);
            //jtpMain.getDocument().insertString(jtpMain.getCaretPosition(), "<h1>Hello There!</h1>", (AttributeSet)null);
          }
        }
        else
        {
View Full Code Here

Examples of javax.swing.text.html.HTMLEditorKit.insertHTML()

                                            byte[] imageData = baos.toByteArray();
                                            String encoded = SimpleBase64.encode(imageData);
                                           
                                            HTMLEditorKit kit = (HTMLEditorKit)jtpMain.getEditorKit();
                                            HTMLDocument d = (HTMLDocument)jtpMain.getDocument();
                                            kit.insertHTML(d,jtpMain.getCaretPosition(),"<img src=\"data:image/x-png;base64," + encoded  + "\" />",0,0,HTML.Tag.IMG);
          }
        }
      }
      else if(command.equals(CMD_CLIP_PASTE_PLAIN))
      {
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.