• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TableColumnModelListener Questions

 
Marcus Hathaway
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I'm having trouble getting a table model to work and wondered if anybody could explain to me exactly how TableColumnModelListener works.

My table model implements TableColumnModelListener ard therefore all its associated methods (e.g. columnRemoved(TableColumnModelEvent e), columnMoved(TableColumnModelEvent e) etc).

However, how do i get these methods to invoke? I thought it would automatically detect table changes, but this is not happening.

Specifically, in my program i am adding and removing columns. I want the table model to keep track of the current column count by doing something like columnCount++ or columnCount-- in the columnRemoved/columnAdded methods. After a column is added or removed, i make the call



Is there anything else i should be doing/considering?

Thanks for any advice!
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
table.getColumnModel.addColumnModelListener(YourTableModel);

Tables have multiple models, the model (or data model), a selection model and a column model.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic