Hi there, I am having a JTable in a JPanel. I am displaying the values in it from the backend. Upto this it is working fine. (I am using DefaultTableModel). My cells are kept editable. I am trying to type something in my cell...it is getting appended.....after that, WITHOUT MOVING THE POINTER TO SOMEOTHER CELL, if i try to collect all the values from the JTable, (using mytablemodel.getDataVector();)....it is giving the old value of that cell....the editted value is not gettting received...but once if i edit and move the cursor to some other cell, i can get the editted value....but how to get the editted(updated) value, without moving the cursor postion??? hope u should have got my question.... waiting for ur reply.... with advance thanx bye, Sakthivel S.
Unfortunately, they didn't automatically enforce a commit with the way Sun programmed it. One workaround I use is to apply a focus listener to the table.
// Add focus listener for JTable to commit edits.
returnsTable.addFocusListener(
new FocusListener() {
publicvoid focusLost( FocusEvent e ) {
returnsTable.getCellEditor().stopCellEditing();
}
publicvoid focusGained( FocusEvent e ) {}
}
);
java]