@Override
public boolean isAutoActivateOkay(JTextComponent tc) {
Document doc = tc.getDocument();
char ch = 0;
try {
doc.getText(tc.getCaretPosition(), 1, s);
ch = s.first();
} catch (BadLocationException ble) { // Never happens
ble.printStackTrace();
}
return (autoActivateAfterLetters && Character.isLetter(ch)) ||
(autoActivateChars!=null && autoActivateChars.indexOf(ch)>-1);
}
when you are typing at the end of your text (the normal caret position) ch will always be the sentinel \n and Character.isLetter(ch) will evaluate to false which is not intended
when you are typing at the end of your text (the normal caret position) ch will always be the sentinel
\nand Character.isLetter(ch) will evaluate to false which is not intended