Fixed Column Table

Purpose

This snippet shows how to create a table with fixed columns in ULC.

How to use

Create two tables which share the table model and the selection model. The column model must not be shared.

	   ULCTable table = new ULCTable(null ,null, fixedColumnsTable.getSelectionModel());
	   table.setAutoResizeMode(ULCTable.AUTO_RESIZE_OFF);
	   table.setAutoCreateColumnsFromModel(false);
	   table.setModel(fixedColumnsTable.getModel());
	


The table model cannot be added in the constructor because the autoCreateColumnsFromModel property default is true. Add the fixed columns to the fixed table column model and the scrollable columns to the scollable table using the ULCTable.addColumn() API. Add both tables to a scroll pane:

	   ULCScrollPane scrollPane = new ULCScrollPane(table);
	   scrollPane.setRowHeaderView(fixedColumnsTable);
	   scrollPane.setCorner(ULCScrollPane.UPPER_LEFT_CORNER,fixedColumnsTable.getTableHeader());
	

Resourcse

Source code - FixedColumnsTable.zip.