| Author |
[JTable] Non editable cells on editable column
|
Francois Dereims
Greenhorn
Joined: May 01, 2008
Posts: 11
|
|
Hi there.
In my JTable, I have a column where all cells are editable to let the user enter values.
Once those values have been saved in the database, I'd like to refresh the JTable and set non editable the cells with a value to prevent all modification. Blank cells must remain editable.
I'm not sure on how to implement this (as the whole column is supposed to be editable).
Any idea ?
|
 |
Stanislav Lapitsky
Ranch Hand
Joined: Dec 01, 2009
Posts: 53
|
|
Use public boolean isCellEditable(int row, int column) method of table or the same method of your TableModel and return false for the non editable values.
Regards,
Stas
|
 |
Francois Dereims
Greenhorn
Joined: May 01, 2008
Posts: 11
|
|
Sorry but I actually don't see...
The matter is to make specific cells dynamically uneditable. How is it possible in the TableModel ? Any example, please ?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
isCellEditable takes a row and column. You can use these to return true or false on each separate invocation.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: [JTable] Non editable cells on editable column
|
|
|