Example usage for javax.swing.text ElementIterator depth

List of usage examples for javax.swing.text ElementIterator depth

Introduction

In this page you can find the example usage for javax.swing.text ElementIterator depth.

Prototype

public int depth() 

Source Link

Document

Fetches the current depth of element tree.

Usage

From source file:LiveParenMatcher.java

public void removeUpdate_2(DocumentEvent de) {
    // print some debugging information before matching the parens
    ElementIterator iter = new ElementIterator(de.getDocument());

    for (Element elem = iter.first(); elem != null; elem = iter.next()) {
        DocumentEvent.ElementChange change = de.getChange(elem);
        if (change != null) { // null means there was no change in elem
            System.out.println("Element " + elem.getName() + " (depth " + iter.depth()
                    + ") changed its children: " + change.getChildrenRemoved().length + " children removed, "
                    + change.getChildrenAdded().length + " children added.\n");
        }//from  w  w  w  . j a  va2s  .  c  om
    }
    SwingUtilities.invokeLater(this); // will call run()
}