Package giis.demo.util
Class TableColumnAdjuster
java.lang.Object
giis.demo.util.TableColumnAdjuster
- All Implemented Interfaces:
PropertyChangeListener,EventListener,TableModelListener
public class TableColumnAdjuster
extends Object
implements PropertyChangeListener, TableModelListener
Class to manage the widths of colunmns in a table (Posted by Rob Camick on November 10, 2008
https://tips4java.wordpress.com/2008/11/10/table-column-adjuster/).
Various properties control how the width of the column is calculated.
Another property controls whether column width calculation should be dynamic.
Finally, various Actions will be added to the table to allow the user
to customize the functionality.
This class was designed to be used with tables that use an auto resize mode
of AUTO_RESIZE_OFF. With all other modes you are constrained as the width
of the columns must fit inside the table. So if you increase one column, one
or more of the other columns must decrease. Because of this the resize mode
of RESIZE_ALL_COLUMNS will work the best.
-
Constructor Summary
ConstructorsConstructorDescriptionTableColumnAdjuster(JTable table) TableColumnAdjuster(JTable table, int spacing) -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustColumn(int column) voidvoidvoidvoidsetColumnDataIncluded(boolean isColumnDataIncluded) voidsetColumnHeaderIncluded(boolean isColumnHeaderIncluded) voidsetDynamicAdjustment(boolean isDynamicAdjustment) voidsetOnlyAdjustLarger(boolean isOnlyAdjustLarger) void
-
Constructor Details
-
TableColumnAdjuster
-
TableColumnAdjuster
-
-
Method Details
-
adjustColumns
public void adjustColumns() -
adjustColumn
public void adjustColumn(int column) -
restoreColumns
public void restoreColumns() -
setColumnHeaderIncluded
public void setColumnHeaderIncluded(boolean isColumnHeaderIncluded) -
setColumnDataIncluded
public void setColumnDataIncluded(boolean isColumnDataIncluded) -
setOnlyAdjustLarger
public void setOnlyAdjustLarger(boolean isOnlyAdjustLarger) -
setDynamicAdjustment
public void setDynamicAdjustment(boolean isDynamicAdjustment) -
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-
tableChanged
- Specified by:
tableChangedin interfaceTableModelListener
-