• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to implement getColumnClass in interface TableModel

 
Kevin Tysen
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to create an implementation of javax.swing.table.TableModel. I have a good idea of how to do most of the implementation, but I don't know how to implement the getColumnClass method.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For most requirements, it is sufficient (and easiest) to extend DefaultTableModel and override getColumnClass(...). You can find an example of overriding getColumnClass(...) in the tutorial linked from the JTable API. The example code shows a class that extends AbstractTableModel, but unless you have rather complex requirements, you won't need to do that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic