Fitting to Contents

The table can dynamically adjust the width of one or more of its columns in order to fit in the available space. The table supports the following resizing modes defined in the enumerated type IlpTableResizeMode:
  • No adjustment: AUTO_RESIZE_OFF
    The width of the columns is never automatically adjusted. If there is more space than used by the columns, it remains empty. If there is less space than required, a horizontal scroll bar displays.
  • Adjust last column: AUTO_RESIZE_LAST_COLUMN
    The last column of the table will be adjusted to allow the width of the table to fit the available space.
  • Proportionally adjust all columns: AUTO_RESIZE_ALL_COLUMNS
    All columns will be proportionally shrunk or expanded to occupy the available space.
    Note
    Unlike what happens in the Swing JTable when the resizing mode is AUTO_RESIZE_LAST_COLUMN and when the entire table is resized, not all the columns are proportionally adjusted. Only the last column is adjusted.
    The default resize mode is AUTO_RESIZE_OFF.
The following example applies the AUTO_RESIZE_LAST_COLUMN mode to tableComponent .

How to resize a table

IlpTable tableComponent = new IlpTable();
// Apply the policy
tableComponent.setAutoResizeMode
  (IlpTableResizeMode.AUTO_RESIZE_LAST_COLUMN) ;
// Now, when a column or the entire table is resized, only the last column 
//is shrunk or expanded
Note
The resize mode can also be controlled through the autoResizeMode property.