• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TableColumnModelListener Questions

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic