Class SwingTableRowHeightUpdater


  • public class SwingTableRowHeightUpdater
    extends Object

    A helper class for setting the correct row heights for a Swing table.

    Swing does not automatically adapt the height of a table's rows to the size of the contained components. This is problematic especially if a custom cell renderer is used. This class implements this functionality. It can be called with a table as argument and then updates the heights of all rows so that the column with the greatest height fits in.

    Since:
    1.3
    Version:
    $Id$
    Author:
    Oliver Heger
    • Constructor Detail

      • SwingTableRowHeightUpdater

        public SwingTableRowHeightUpdater()
    • Method Detail

      • updateRowHeights

        public void updateRowHeights​(JTable table)
        Updates the heights of all rows in the specified table.
        Parameters:
        table - the table
      • updateRowHeights

        public void updateRowHeights​(JTable table,
                                     int startRow,
                                     int endRow)
        Updates the heights of all rows of the specified table in the given range. Note that this obviously has to be done in a separate task in the event queue; otherwise, row height updates do not have any effect.
        Parameters:
        table - the table
        startRow - the index of the first row
        endRow - the index of the last row (including)