How to make a JTable non-editable
java, jtable, swing
Solution
You can use a `TableModel`.
Define a class like this:
public class MyModel extends AbstractTableModel{
//not necessary
}
actually `isCellEditable()` is `false` by default so you may omit it. (see: http://docs.oracle.com/javase/6/docs/api/javax/swing/table/AbstractTableModel.html)
Then use the `setModel()` method of your `JTable`.
JTable myTable = new JTable();
myTable.setModel(new MyModel());
Problem
How to make a `JTable` non-editable? I don't want my users to be able to edit the values in cells by double-clicking them.