Java Swing HTML isUnderline(Element element)

Here you can find the source of isUnderline(Element element)

Description

is Underline

License

BSD License

Declaration

public static boolean isUnderline(Element element) 

Method Source Code

//package com.java2s;
/**// ww  w.j  a  v a  2 s .c o m
 * Kuebiko - SwingHtmlUtil.java
 * Copyright 2011 Dave Huffman (dave dot huffman at me dot com).
 * Open source under the BSD 3-Clause License.
 */

import javax.swing.text.Element;

import javax.swing.text.html.CSS;

public class Main {
    public static boolean isUnderline(Element element) {
        return containsAttribute(element, CSS.Attribute.TEXT_DECORATION, "underline");
    }

    public static boolean containsAttribute(Element element, Object name, Object value) {
        if (element == null) {
            return false;
        }

        Object attribute = element.getAttributes().getAttribute(name);

        if (attribute == null) {
            return containsAttribute(element.getParentElement(), name, value);
        }
        return value.equals(attribute.toString());
    }
}

Related

  1. getHTMLFromXML(String xml, URL xsl)
  2. getImgs(final String html)
  3. getRowIndex(final Element cell)
  4. hasClass(AttributeSet attr, String className)
  5. htmlToPlain(String html)
  6. loadStyleSheet(URL url)
  7. makeStyleSheet(String name)
  8. nameOf(Element element)
  9. plainToHtml(String plain)