GroupTableColumn

Top  Previous  Next

 

GroupTableColumn is a TableColumn subclass that contains children TableColumns. In addition, it holds a reference to its parent GroupTableColumn. The group table columns have a tree-like structure, with a GroupTableColumn as the root column. This tree is effectively created and managed by GroupTableHeader.

 

You can create a GroupTableColumn by supplying the header value to display, the default width and the renderer, editor that is installed.

 

e.g.

 

GroupTableColumn gtc = new GroupTableColumn("Personal Details");

 

You can add/remove table columns or group table columns as children with:

 

public void addColumn(TableColumn aColumn);

public void removeColumn(int columnIndex);

public void removeColumn(TableColumn aColumn);

 

Columns can be added to the group table column after they have been created by the table or the table column model.

 

Additionally, you can control the children columns visibilty with:

 

public boolean getShowChildren();

public void setShowChildren(boolean showChildren);

 

Example: Create a GroupTableColumn

 

GroupTableColumn gtc = new GroupTableColumn("Name");

gtc.addColumn(table.getColumnModel().getColumn(0)); //refers to the normal column at index 0

gtc.addColumn(table.getColumnModel().getColumn(1)); //refers to the normal column at index 1