| Author |
celleditor won't stick
|
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
I have table And later I make a call Odd thing is, that the cellEditor is null. what am I missing? thanks in advance. Bing
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
i think it is a scope issue. you only show the constructor for MyTable, but i notice you use a local variable DefaultCellEditor cellEditor = new DefaultCellEditor(editor); make that an instance variable and i think will fix problem
|
SCJP
|
 |
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
That's not true, I think. The cellEditor is being set during the table construction. So it should stick with the table. It then exists in the table interval structure until the table get GCed. And I can be sure that that's the only constructor and the table has not been reconstructed in other way. And please notice that I call myTable.getCellEditor() which as far as I understand it, should return the one we set for early on. Any more thoughts? Thanks for the response. Bing
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 4092
|
|
d'oh! i see now DefaultCellEditor cellEditor = (DefaultCellEditor)myTable.getCellEditor(); did you make an instance variable in main() called myTable? is it an instance of MyTable class? did you write method getCellEditor()?
|
 |
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
I do have a instance of MyTable called myTable in the main. And the MyTable constructor part you've seen in my first post. There is another method in MyTable I named it In my main method, I call myTable.stopMyTableCellEditing() trying to flush the changes made to the tableModel data vector. getCellEditor() and setCellEditor() is are JTable methods. I don't write them myselft. Hope this clear things better Thanks for the message Bing
|
 |
Ben Zung
Ranch Hand
Joined: Mar 25, 2004
Posts: 109
|
|
Please pardon my English too.
In my main method, I call myTable.stopMyTableCellEditing() trying to flush the changes made to the tableModel data vector.
I meant to flush the changes made to the table view into the table model data vector Bing [ April 24, 2004: Message edited by: Bing Yuen ]
|
 |
 |
|
|
subject: celleditor won't stick
|
|
|