public int markAll(String toMark,boolean matchCase,boolean wholeWord,boolean regex){
  Highlighter h=getHighlighter();
  int numMarked=0;
  if (toMark != null && !toMark.equals(markedWord) && h != null) {
    if (markAllHighlights != null)     clearMarkAllHighlights();
 else     markAllHighlights=new ArrayList(10);
    int caretPos=getCaretPosition();
    markedWord=toMark;
    setCaretPosition(0);
    boolean found=SearchEngine.find(this,toMark,true,matchCase,wholeWord,regex);
    while (found) {
      int start=getSelectionStart();
      int end=getSelectionEnd();
      try {
        markAllHighlights.add(h.addHighlight(start,end,markAllHighlightPainter));
      }
 catch (      BadLocationException ble) {
        ble.printStackTrace();
      }
      numMarked++;
      found=SearchEngine.find(this,toMark,true,matchCase,wholeWord,regex);
    }
    setCaretPosition(caretPos);
    repaint();
  }
  return numMarked;
}

public int markAll ( String toMark , boolean matchCase , boolean wholeWord , boolean regex ) { Highlighter h = getHighlighter ( ) ; int numMarked = 0 ; if ( toMark != null && ! toMark . equals ( markedWord ) && h != null ) { if ( markAllHighlights != null ) clearMarkAllHighlights ( ) ; else markAllHighlights = new ArrayList ( 10 ) ; int caretPos = getCaretPosition ( ) ; markedWord = toMark ; setCaretPosition ( 0 ) ; boolean found = SearchEngine . find ( this , toMark , true , matchCase , wholeWord , regex ) ; while ( found ) { int start = getSelectionStart ( ) ; int end = getSelectionEnd ( ) ; try { markAllHighlights . add ( h . addHighlight ( start , end , markAllHighlightPainter ) ) ; } catch ( BadLocationException ble ) { ble . printStackTrace ( ) ; } numMarked ++ ; found = SearchEngine . find ( this , toMark , true , matchCase , wholeWord , regex ) ; } setCaretPosition ( caretPos ) ; repaint ( ) ; } return numMarked ; }
marks all instances of the specified text in this text area .
