tags:

views:

14

answers:

2

Hey,

Is there a way to disable editing a JTable after creating it. Because my JTable is created automaticly using GUI Tools and I cannot edit the source code where it creates the JTable.

Cheers

A: 

If you have access to the source code, and have a reference to the frame, you could still programatically traverse the container tree until you get to the table, then call whatever you need on it.

Uri
A: 

Yes, but it's in your TableModel. There's a method called isCellEditable If you can't manipulate your model, can try something like this:

jtableObject.setModel(jtableObject().getModel(){
   isCellEditable(int rowIndex, int columnIndex) {
       return false;
   }
});

Your object must be created! It's a little confusing code. There you're creating an anonymous class.

Remember, when you talk about "editing", what you're actually editing, is the data stored in that table. The data is represented in the TableModel.

santiagobasulto