public static void markText(JTextComponent pane,int start,int end,SimpleMarker marker){
  try {
    Highlighter hiliter=pane.getHighlighter();
    int selStart=pane.getSelectionStart();
    int selEnd=pane.getSelectionEnd();
    if (selStart == selEnd || end < selStart || start > selStart) {
      hiliter.addHighlight(start,end,marker);
      return;
    }
    if (selStart > start && selStart < end) {
      hiliter.addHighlight(start,selStart,marker);
    }
    if (selEnd > start && selEnd < end) {
      hiliter.addHighlight(selEnd,end,marker);
    }
  }
 catch (  BadLocationException ex) {
    LOG.log(Level.SEVERE,null,ex);
  }
}

public static void markText ( JTextComponent pane , int start , int end , SimpleMarker marker ) { try { Highlighter hiliter = pane . getHighlighter ( ) ; int selStart = pane . getSelectionStart ( ) ; int selEnd = pane . getSelectionEnd ( ) ; if ( selStart == selEnd || end < selStart || start > selStart ) { hiliter . addHighlight ( start , end , marker ) ; return ; } if ( selStart > start && selStart < end ) { hiliter . addHighlight ( start , selStart , marker ) ; } if ( selEnd > start && selEnd < end ) { hiliter . addHighlight ( selEnd , end , marker ) ; } } catch ( BadLocationException ex ) { LOG . log ( Level . SEVERE , null , ex ) ; } }
add highlights for the given region on the given pane
