In a JTable, if I type a value in table cell and when I click the button to print the value of that cell. But I input a value and immediately click the button it does not print. If I press enter after the input a value in cell and click on the button, now it prints well. How can I prevent this in my table ?
Asked
Active
Viewed 174 times
1
-
2no idea what do you talking about, maybe is one, two mindreaders around, otherwise for better help sooner post an [SSCCE](http://sscce.org/), short, runnable, compilable, just about JFrame with JTable and JButton – mKorbel Aug 24 '13 at 11:36
1 Answers
3
In a JTable, if I type a value in table cell and when I click the button to prints the value of that cell. But I input a value and immediately click the button it's not print. If I press enter after the input a value in cell and click on the button, now it's print well. How can I prevent this in my table ?
my shots in the dark
set
myTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
forDefaultCellEditor
or
override
public boolean stopCellEditing() {
for any custom editors types e.g.XxxCellEditor implements TableCellEditor {

mKorbel
- 109,525
- 20
- 134
- 319
-
+1 for `"terminateEditOnFocusLost"`; more [here](http://stackoverflow.com/a/12826753/230513) and [here](http://stackoverflow.com/a/12884697/230513). – trashgod Aug 24 '13 at 11:55