AbbreviatingTableLabelingAlgorithm algorithm = new AbbreviatingTableLabelingAlgorithm();
algorithm.setOrientation(TableOrientation.COLUMN_MAJOR);
algorithm.setContextLabels("Ku_VBSP");
LabeledTableModel model = new LabeledTableModel(algorithm, TableOrientation.COLUMN_MAJOR) {
@Override
public int getObjectCount() {
return data.length;
}
@Override
public int getAttributeCount() {
return data[0].length;
}
@Override
public Object getObjectAt(int rowIndex, int columnIndex) {
return data[rowIndex][columnIndex];
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
@Override
public String getObjectIdentifierAt(int rowIndex, int columnIndex) {
// TODO Auto-generated method stub
return identifiers[rowIndex][columnIndex];
}
@Override
protected boolean canSetObjectAt(int rowIndex, int columnIndex,
boolean isInsertRow, boolean isInsertColumn) {
// TODO Auto-generated method stub
return false;
}
@Override
protected void setObjectAt(Object value, int rowIndex,
int columnIndex, boolean isInsertRow, boolean isInsertColumn) {
// TODO Auto-generated method stub
}
@Override
public Object getStoredObjectAt(int objectIndex, int attributeIndex) {
return data[objectIndex][attributeIndex];
}
@Override
public boolean isSkeleton() {
// TODO Auto-generated method stub
return false;
}
};
model.updateLabels();
//Create and set up the window.
JFrame frame = new JFrame("SimpleTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);