Search code examples
javaswingjtextfield

Uneditable JTextField with cursor selection enabled


Is it possible to keep the JTextField uneditable, but keep the selection option using cursor enabled?


Solution

  • Simply set editable to false via setEditable(...) The default for the focusable property is true so there will be no need to call setFocusable(...).