Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLDocument


    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        JEditorPane pane = (JEditorPane) e.getSource();
        if (e instanceof HTMLFrameHyperlinkEvent) {
          HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
          HTMLDocument doc = (HTMLDocument) pane.getDocument();
          doc.processHTMLFrameHyperlinkEvent(evt);
        } else {
          try {
            pane.setPage(e.getURL());
          } catch (Throwable t) {
            t.printStackTrace();
View Full Code Here


    imageURL = getClass().getClassLoader().getResource(IConstants.SIMLEY_URL+"0029.gif");
    msg = msg.replace(":P", "<img src='"+imageURL+"'>");
   
   
    HTMLDocument doc = (HTMLDocument) this.getDocument();
    try {

      if (this.getShowDatum()) {
        DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT);
        Date = "<span style='color:#C0C0C0;'>" + "["
            + df.format(System.currentTimeMillis()) + "]</span> ";

      }

      ((HTMLEditorKit) this.getEditorKit()).insertHTML(doc, doc
          .getLength(), "<div>" + Date + From + msg + "</div>", 0, 0,
          null);

    } catch (IOException ex) {
      this.logger.warning(ex.toString());
    } catch (BadLocationException ex) {
      this.logger.warning(ex.toString());
    }

    this.setCaretPosition(doc.getLength());

  }
View Full Code Here

                              HyperlinkEvent.EventType.ACTIVATED) {
              JEditorPane pane = (JEditorPane) e.getSource();
              if (e instanceof HTMLFrameHyperlinkEvent) {
                HTMLFrameHyperlinkEvent evt =
                                       (HTMLFrameHyperlinkEvent)e;
                HTMLDocument doc =
                     (HTMLDocument)pane.getDocument();
                doc.processHTMLFrameHyperlinkEvent(evt);
              } else try {
                       // Normaler Link
                       pane.setPage(e.getURL());
                     } catch (Throwable t) {
                         t.printStackTrace();
View Full Code Here

                if (target.equals("_browser")) {
                    useBrowser = true;
                } else if (!target.equals("_blank") && !target.equals("_top")) {
                    // If the target is "_blank" or "_top", then we want to open
                    // in a new window, so we defer to the below.
                    HTMLDocument doc = (HTMLDocument) pane.getDocument();
                    try {
                        doc.processHTMLFrameHyperlinkEvent(frameHyperlinkEvent);
                    } catch (Exception ex) {
                        MessageHandler.error("Hyperlink reference failed", ex);
                    }

                    return;
View Full Code Here

        if (_styleSheetURL != null) {
            // If _styleSheetURL is non-null, we set the style sheet
            // once and only once.  If try to do this in a static initializer,
            // then the styles are wrong.
            HTMLDocument doc = (HTMLDocument) pane.getDocument();
            StyleSheet styleSheet = doc.getStyleSheet();
            styleSheet.importStyleSheet(_styleSheetURL);
            new HTMLEditorKit().setStyleSheet(styleSheet);
            _styleSheetURL = null;
        }
View Full Code Here

        }
        return resource;
    }

    public static StyledDocument createHtmlDocument() {
        HTMLDocument document = new HTMLDocument();
        document.setBase(locationOfResource(MEDIA_ROOT));
        return document;
    }
View Full Code Here

  public static final int LINE_CHARS = 60;
  public static final int SEGMENT_CHARS = 10;
 
  public static Document format(Sequence sequence) throws IOException, BadLocationException {
    HTMLEditorKit editorKit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
    editorKit.read(new StringReader(HTMLUtils.renderSequence(sequence.getSequence(), true)), doc, 0);
    return doc;
  }
View Full Code Here

    return doc;
  }

  public static Document format(AlignmentStore alignmentStore) throws IOException, BadLocationException {
    HTMLEditorKit editorKit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument)editorKit.createDefaultDocument();
    editorKit.read(new StringReader(alignmentStore.getHTMLAlignment()), doc, 0);
    return doc;
  }
View Full Code Here

    helpPane.setContentType("text/html");
    helpPane.setEditable(false);
    helpPane.setPreferredSize(Size.dialog_panel_help);
    try {
      HTMLEditorKit editorKit = new HTMLEditorKit();
      HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();
      editorKit.read(new StringReader(helpDoc), doc, 0);
      helpPane.setDocument(doc);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
View Full Code Here

    {
      JEditorPane pane = (JEditorPane) e.getSource();
      if (e instanceof HTMLFrameHyperlinkEvent)
      {
        HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e;
        HTMLDocument doc = (HTMLDocument) pane.getDocument();
        doc.processHTMLFrameHyperlinkEvent(evt);
      }
      else
      {
        try
        {
View Full Code Here

TOP

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

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.