Package com.jsql.view.swing.table
Class AdjusterTableColumn
java.lang.Object
com.jsql.view.swing.table.AdjusterTableColumn
- All Implemented Interfaces:
PropertyChangeListener,EventListener,TableModelListener
public class AdjusterTableColumn
extends Object
implements PropertyChangeListener, TableModelListener
Class to manage the widths of columns in a table.
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
ConstructorsConstructorDescriptionAdjusterTableColumn(JTable table) Specify the table and use default spacingAdjusterTableColumn(JTable tableAdjust, int spacing) Specify the table and spacing -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustColumn(int column) Adjust the width of the specified column in the tablevoidAdjust the widths of all the columns in the tablevoidImplement the PropertyChangeListenervoidRestore the widths of the columns in the table to its previous widthvoidsetColumnDataIncluded(boolean isColumnDataIncluded) Indicates whether to include the model data in the width calculationvoidsetColumnHeaderIncluded(boolean isColumnHeaderIncluded) Indicates whether to include the header in the width calculationvoidsetDynamicAdjustment(boolean isDynamicAdjustment) Indicate whether changes to the model should cause the width to be dynamically recalculated.voidsetOnlyAdjustLarger(boolean isOnlyAdjustLarger) Indicates whether columns can only be increased in sizevoidImplement the TableModelListener
-
Constructor Details
-
AdjusterTableColumn
Specify the table and use default spacing -
AdjusterTableColumn
Specify the table and spacing
-
-
Method Details
-
adjustColumns
public void adjustColumns()Adjust the widths of all the columns in the table -
adjustColumn
public void adjustColumn(int column) Adjust the width of the specified column in the table -
restoreColumns
public void restoreColumns()Restore the widths of the columns in the table to its previous width -
setColumnHeaderIncluded
public void setColumnHeaderIncluded(boolean isColumnHeaderIncluded) Indicates whether to include the header in the width calculation -
setColumnDataIncluded
public void setColumnDataIncluded(boolean isColumnDataIncluded) Indicates whether to include the model data in the width calculation -
setOnlyAdjustLarger
public void setOnlyAdjustLarger(boolean isOnlyAdjustLarger) Indicates whether columns can only be increased in size -
setDynamicAdjustment
public void setDynamicAdjustment(boolean isDynamicAdjustment) Indicate whether changes to the model should cause the width to be dynamically recalculated. -
propertyChange
Implement the PropertyChangeListener- Specified by:
propertyChangein interfacePropertyChangeListener
-
tableChanged
Implement the TableModelListener- Specified by:
tableChangedin interfaceTableModelListener
-