A good first step is to establish a standard way to specify how many columns are to remain fixed, while the others are free to scroll. Do this by extending AbstractTableModel, to include an identityColumnCount member, and getIdentityColumnCount and setIdentityColumnCount methods.
1 package com.vizitsolutions.identitytable; 2 3 import javax.swing.table.AbstractTableModel; 4 5 /** 6 * <p>$Id$</p> 7 * 8 * <p> 9 * An extension of the AbstractTableModel to include the concept of a 10 * horizontally fixed set of columns that identify the contents of a row. 11 * </p> 12 * 13 * @author akluge 14 * @version $Revision$, $Date$ 15 */ 16 public abstract class IdentityTableModel extends AbstractTableModel 17 { 18 /** 19 * The number of columns to keep fixed in place 20 * when horizontally scrolling the table. 21 */ 22 protected int identityColumnCount; 23 24 /** 25 * Get the number of columns that identify the contents of each row. These 26 * columns remain fixed in place when the table scrolls horizontally. 27 * 28 * @return An int giving the number of columns that identify the contents 29 * of each row. 30 */ 31 public int getIdentityColumnCount() 32 { 33 return identityColumnCount; 34 } 35 36 /** 37 * Set the number of rows that identify the contents of each row. These 38 * columns remain fixed in place when the table scrolls horizontally. 39 * 40 * @param identityColumnCount An int giving the number of rows that 41 * identify the contents of each row. 42 */ 43 public void setIdentityColumnCount(int identityColumnCount) 44 { 45 this.identityColumnCount = identityColumnCount; 46 } 47 } 48 49