user1167319
user1167319

Reputation: 1

JAVA: JCheckBox lost selection in a JTable when Button pressed

I have this problem: added a jcheckbox in a jtable. In my model this jcheckbox is loaded with getValueAt and used the method setValueAt when selected by the user.

No problem until I push the confirm button, when all my row selected (true value) disappear and the loop doesn't read anything with true value.

Where is my mistake? How can I update the model before pressing my confirmation button?

Upvotes: 0

Views: 179

Answers (1)

kleopatra
kleopatra

Reputation: 51535

Sounds like you are looking for:

table.putClientProperty("terminateOnFocusLost", true);

This tells the table to try to commit any ongoing edits when the focus is transfered to the outside, that is to a component which is not a child of the table.

Upvotes: 1

Related Questions