Example usage for javax.swing.text AttributeSet containsAttribute

List of usage examples for javax.swing.text AttributeSet containsAttribute

Introduction

In this page you can find the example usage for javax.swing.text AttributeSet containsAttribute.

Prototype

public boolean containsAttribute(Object name, Object value);

Source Link

Document

Returns true if this set defines an attribute with the same name and an equal value.

Usage

From source file:Main.java

private void listAttributes(AttributeSet attributes) {
    Enumeration e = attributes.getAttributeNames();
    while (e.hasMoreElements()) {
        Object name = e.nextElement();
        Object value = attributes.getAttribute(name);
        if (!attributes.containsAttribute(name.toString(), value)) {
            System.out.println("containsAttribute() fails");
        }/* w ww.ja va  2s .c  o  m*/
        if (!attributes.isDefined(name.toString())) {
            System.out.println("isDefined() fails");
        }
        System.out.println(name + "=" + value);
    }
}