Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

celleditor won't stick

 
Ben Zung
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4353
2
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ben Zung
Ranch Hand
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4353
2
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic