GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes TableColumnModelListener Questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TableColumnModelListener Questions" Watch "TableColumnModelListener Questions" New topic
Author

TableColumnModelListener Questions

Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
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

Joined: Dec 12, 2002
Posts: 580
table.getColumnModel.addColumnModelListener(YourTableModel);

Tables have multiple models, the model (or data model), a selection model and a column model.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TableColumnModelListener Questions