List of usage examples for javax.swing.text Segment next
public char next()
From source file:LiveParenMatcher.java
public void insertUpdate_3(DocumentEvent de) { Document doc = de.getDocument(); int offset = de.getOffset(); int length = de.getLength(); Segment seg = new Segment(); try {//from w w w . j av a 2 s.c om doc.getText(offset, length, seg); // text placed in Segment } catch (BadLocationException ble) { } // iterate through the Segment for (char ch = seg.first(); ch != seg.DONE; ch = seg.next()) if (ch == '(' || ch == '[' || ch == '{' || ch == ')' || ch == ']' || ch == '}') { SwingUtilities.invokeLater(this); // will call run() return; // no need to check further } }