Not really sure how to word the title with out making it a paragraph long.
Basically I have a JTable in my program that I can’t let the users edit. But the program must be able to edit it itself. Futhermore, the user must be allowed to actually select and copy text from the cells in the table, just not edit it.
How can I achieve this? Preferably a generic solution so it can be applied to multiple tables within my program with different layouts etc.
In you need to set the selection properties of your table to true, like below. You also have to make sure that the
isCellEditablemethod is overridden and set to false, theAbstractTableModelclass does this by default.This will allow the cell to be highlight individually and copied from but will not allow editing of the cell.
EDIT: Changed answer!