Keep caret in TextArea when non-editable
I think the following will help you:
textArea.getCaret().setVisible(true);
or
textArea.getCaret().setSelectionVisible(true);
As for the answers above
textArea.getCaret().setVisible(true);
does not always work perfectly, if the TextArea or EditorPane loses focus, say you click on a different frame or something, when you come back the cursor will be invisible again.
I have had the same issues, it appears the solution is to add a focus listener and set it visible every time the editor gains focus.
text.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
text.getCaret().setVisible(true); // show the caret anyway
}
});