3

When double click on editable cell of jtable it shown as here.

follow

what i need is if user click mouse outside table of press a button before entering the value then existing value should be auto entered and output should be shown as follow.

after

Any help or suggestion would be greatly appreciated.

Community
  • 1
  • 1
chAmi
  • 1,774
  • 3
  • 20
  • 27

1 Answers1

11
  1. for DefaultTableModel works by default myJTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);

  2. override stopCellEditing()

    a) public boolean stopCellEditing()

    b) myJTable.getCellEditor().stopCellEditing();

    c) myJTable.getCellEditor(row, col).stopCellEditing();

mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • 1
    thanks mKorbel. I just found this link also have solution releated to this. http://stackoverflow.com/questions/1652942/can-a-jtable-save-data-whenever-a-cell-loses-focus – chAmi Oct 14 '12 at 17:36
  • 2
    before any questions about JTable search for answers by (@camickr) or (@kleopatra), then you'll 100pct of success :-) – mKorbel Oct 14 '12 at 17:38
  • yeah...good point. Seems It's worth than couple of hours googling. – chAmi Oct 14 '12 at 17:44