File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable - tableChanged not firing with AbstractTableModel

 
Marcos Stythe
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I've tried various things, but nothing seems to work. Here is my entire class.
My class extends JPanel, implements TableModelListener, and displays a JTable. I create a AbstractTableModel as an inner class which the JTable uses.
I call table.getModel().addTableModelListener(this); thinking it should then add the listener and therefore call tableChanged(...) if changes are made, but this doesn't seem to be the case.
Any help is most appreciated.
 
Don Kiddick
Ranch Hand
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your AbstractTableModel call the fireTable*** methods when the data is changed ? If not, it needs to.
D.
 
Marcos Stythe
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to call the tableChanged(..) method when the user edits a cell in the JTable. I am not sure how to go about calling the fireTable* methods when the user edits a cell.
Marcos.
 
Don Kiddick
Ranch Hand
Posts: 580
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the user edit a cell, the setValue() method gets called on your TableModel. You should call fireTableCellUpdated() here.
does that help ?
D.
 
Marcos Stythe
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
YOU BEAUTY!
That ends weeks of torment, thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic