Class SwingTableColumnWidthListener

  • All Implemented Interfaces:
    ComponentListener, EventListener, TableColumnModelListener

    public class SwingTableColumnWidthListener
    extends ComponentAdapter
    implements TableColumnModelListener

    A specialized event listener class for keeping track of and resizing the columns of a table.

    This class plays an important role in the Swing-specific implementation of tables with relative column widths. An instance is associated with a TableColumnWidthController object and registered as listener for certain events at a table component. In this constellation this class performs the following tasks:

    • When the table component is resized, it ensures that the widths of the columns are correctly set. This is especially important for columns with a percent width: the space available is distributed to the columns based on their relative width.
    • When the user manually resizes a column the TableColumnWidthController is updated so that it is notified about the new column width.

    This class is used internally by the Swing-specific table implementation. If a table has columns with a percent width, the component manager implementation creates an instance and registers it at the table. It is not intended to be used by applications directly.

    Version:
    $Id: SwingTableColumnWidthListener.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • SwingTableColumnWidthListener

        public SwingTableColumnWidthListener​(JTable tab,
                                             net.sf.jguiraffe.gui.builder.components.tags.table.TableColumnWidthController ctrl)
        Creates a new instance of SwingTableColumnWidthListener and initializes it.
        Parameters:
        tab - the table to be monitored
        ctrl - the associated TableColumnWidthController