annotool.gui
Class TableColumnAdjuster

java.lang.Object
  extended by annotool.gui.TableColumnAdjuster
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.TableModelListener

public class TableColumnAdjuster
extends java.lang.Object
implements java.beans.PropertyChangeListener, javax.swing.event.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.

Author:
Rob Camick: http://tips4java.wordpress.com/2008/11/10/table-column-adjuster/

Constructor Summary
TableColumnAdjuster(javax.swing.JTable table)
           
TableColumnAdjuster(javax.swing.JTable table, int spacing)
           
 
Method Summary
 void adjustColumn(int column)
           
 void adjustColumns()
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void restoreColumns()
           
 void setColumnDataIncluded(boolean isColumnDataIncluded)
           
 void setColumnHeaderIncluded(boolean isColumnHeaderIncluded)
           
 void setDynamicAdjustment(boolean isDynamicAdjustment)
           
 void setOnlyAdjustLarger(boolean isOnlyAdjustLarger)
           
 void tableChanged(javax.swing.event.TableModelEvent e)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableColumnAdjuster

public TableColumnAdjuster(javax.swing.JTable table)

TableColumnAdjuster

public TableColumnAdjuster(javax.swing.JTable table,
                           int spacing)
Method Detail

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

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

tableChanged

public void tableChanged(javax.swing.event.TableModelEvent e)
Specified by:
tableChanged in interface javax.swing.event.TableModelListener