List of usage examples for javax.swing.text ElementIterator depth
public int depth()
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() }