String (int startIdx, int endIdx) { if (startIdx >= 0 && endIdx > startIdx) { CharSequence chars = getDocument().getImmutableCharSequence(); return chars.subSequence(startIdx, endIdx).toString(); } return ""; }