Table State

Top  Previous  Next

 

You can programmatically alter the table columns displayed and their widths by using:

 

public void setTableState(String state);

 

The string to pass in this method should be specially formatted as follows:

 

<state> = i1:w1,i2:w2,... where i is the column's model index and w its width.

 

You can also get a string of the table's state by calling:

 

public String getTableState();

 

 

Note: A column which is removed by calling this method can always be added later if its model index is supplied. Only columns that are removed via the removeColumn method of JTable are permanently removed from the table.