This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "TableColumnModelListener Questions" Watch "TableColumnModelListener Questions" New topic

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

Tables have multiple models, the model (or data model), a selection model and a column model.
Don't get me started about those stupid light bulbs.
subject: TableColumnModelListener Questions
Similar Threads
What listener for JTable header column size change
Understanding JTable.addColumn()
Restrict the User to Move a Column in a JTable Component
JTable : Setting Column Resize Off On MarginChanged Event
Notifying listeners of changes in jtable cell selection