0
votes

Let's say I have a JTable with two columns, A and B. Let's say I also have a List/Vector/Array (any collection) that contains some Strings. When I am done editing cell at row x, column A (pressing enter or selecting another cell or component), I want the JTable to check if what I typed in column A at row x is in my List. If it is the case, I want to disable editing in Column B at row X and set that cell to "Ok".

I have no idea how to do this. I have searched but found some cases that were different from mine.

Any help will be greatly apreciated.

Cheers :)

1

1 Answers

1
votes

What you need is a custom table model. The TableModel interface contains a method isCellEditable with wich you can controll this behaviour. To render a cell with "OK" and maybe a colored background you have to use a custom CellRenderer