See my answer here which shows auto completion for JTextComponent
, it can show pop up window of auto completion words to the current caret index on JTextPane
/JEditorPane
(+1 @AndrewThompson for the idea):
For JTextField
:
and for other JTextComponent
s i.e JTextPane
, JEditorPane
etc its shown at the current caret index:
To change text colour of words (i.e syntax highlight) have a look here:
Or if you want rather a highlighted word. See here: