Home » Java » Copy text from a disabled JTextField

Copy text from a disabled JTextField

Posted by: admin December 28, 2021 Leave a comment


Is it possible to allow a user to copy text from within a disabled JTextField? At the moment if I have a text field that is disabled, the user is unable to select the text to copy and paste into another app.


Make the text field non editable, then you can still use the mouse to select text.

You can also change the font color to make it look disabled.


Camickr’s suggestions are the right on, but alternatively you could add a right click menu option with a copy action.