Package javax.swing.text.html

Examples of javax.swing.text.html.HTMLDocument


     * @see javax.swing.event.HyperlinkListener#hyperlinkUpdate(javax.swing.event.HyperlinkEvent)
     */
    public void hyperlinkUpdate (HyperlinkEvent event){
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
            if (event instanceof HTMLFrameHyperlinkEvent) {
                HTMLDocument doc = (HTMLDocument)viewer.getDocument ();
                doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent)event);
            } else

                displayPageEvent(event.getURL());

        }
View Full Code Here


    ss.addStyleSheet(styles);

    ss.addRule("body {font-family:arial;font-size:12pt}");
    ss.addRule("p {font-family:arial;margin:2}");

    HTMLDocument doc = new HTMLDocLinkDetector(ss);

    setEditorKit(htmlkit);

    setDocument(doc);
View Full Code Here

    String obj = sentence.getObjectName();
    tfObject.setText(obj != null ? obj :
      "[" + sentence.getObjectCount() + " objects]");

    HTMLDocument d = initHtml(tpExpressions);

    int unknown = 0;
    for (Expression e : sentence) {
      String style = "";
      ExpressionType t = e.getType();
View Full Code Here

   */
  @Override
  protected void initStylesForTextPane(final JTextPane textPane) {
    textPane.setContentType("text/html");

    final HTMLDocument doc = (HTMLDocument) textPane.getDocument();
    final StyleSheet css = doc.getStyleSheet();

    /*
     * Configure standard styles
     */
    css.addRule("body { font-family: Dialog; font-size: " + (TEXT_SIZE + 1)
View Full Code Here

   *
   * @param text
   *            The HTML text to add.
   */
  protected void appendString(final String text) {
    final HTMLDocument doc = (HTMLDocument) textPane.getDocument();

    try {
      final Element root = doc.getParagraphElement(0);
      doc.insertBeforeEnd(root, text);
    } catch (final BadLocationException e) {
      logger.error(e, e);
    } catch (final IOException e) {
      logger.error(e, e);
    }
View Full Code Here

        URLConnection con = google.openConnection();
        con.setRequestProperty("User-Agent", "");
        InputStream in = con.getInputStream();
        try {
            HTMLEditorKit kit = new HTMLEditorKit();
            HTMLDocument doc = new HTMLDocument();
            doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
            kit.read(new InputStreamReader(in, "UTF-8"), doc, 0);
            HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
            while (it.isValid()) {
                if(it.getAttributes() != null) {
                    String href = (String) it.getAttributes().getAttribute(HTML.Attribute.HREF);
                    if (href != null && href.endsWith("." + currentFiletype)) {
                        URL url = new URL(new URL("http", "www.google.com", "dummy"), href);
View Full Code Here

         *
         * @param content an HTML document
         */
        private void setDocumentContent(String content) {
       
            HTMLDocument doc = new HTMLDocument();
            try {
                doc.remove(0, doc.getLength());
            } catch (BadLocationException e) {
                e.printStackTrace();
            }
            doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
       
            try {
                htmlPane.read(new ByteArrayInputStream(content.getBytes()), doc);
            } catch (IOException e) {
                e.printStackTrace();
View Full Code Here

    editorPane = new JEditorPane();
    editorPane.setEditable(false);
    editorPane.setContentType("text/html");//NON-NLS
    editorPane.setText(getSystemInformationAsHTML());
    final HTMLDocument htmlDocument = (HTMLDocument) editorPane.getDocument();
    htmlDocument.getStyleSheet().addRule("body { font-family:sans-serif; }");//NON-NLS
    editorPane.setCaretPosition(0);

    super.init();
    getConfirmAction().putValue(Action.NAME, UtilMessages.getInstance().getString("SystemInformationDialog.Close"));
  }
View Full Code Here

    return true;
  }

  private boolean isInvisible(final javax.swing.text.Element textElement)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    final Object o = attr.getAttribute(CSS.Attribute.DISPLAY);
    if ("none".equals(String.valueOf(o)))
    {
      return true;
View Full Code Here

    return false;
  }

  private void configureStyle(final javax.swing.text.Element textElement, final Element result)
  {
    final HTMLDocument htmlDocument = (HTMLDocument) textElement.getDocument();
    final StyleSheet sheet = htmlDocument.getStyleSheet();
    final AttributeSet attr = computeStyle(textElement, sheet);
    parseBorderAndBackgroundStyle(result, sheet, attr);
    parseBoxStyle(result, attr);

    final Font font = sheet.getFont(attr);
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.