List of usage examples for javax.swing.text Segment first
public char first()
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 {//ww w.j a va 2 s. com 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 } }