Class ColumnResizer

java.lang.Object
org.cytoscape.util.swing.ColumnResizer

public final class ColumnResizer extends Object
Automatically resize column based on the objects in the cell.

From Swing Hacks by Joshua Marinacci and Chris Adamson.
2005 Oreilly & Associates Inc. ISBN: 0-596-00907-0

Author:
Joshua Marinacci, Chris Adamson, Keiichiro Ono

Cytoscape Backwards Compatibility (Static Class): This class is static and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

Module: swing-util-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>swing-util-api</artifactId>
</dependency>
  • Method Details

    • adjustColumnPreferredWidths

      public static void adjustColumnPreferredWidths(JTable table)
      Adjust the columns in the table to their preferred widths. This method considers the preferred width of the cells in all rows in addition to the column headers.
      Parameters:
      table - The table whose columns should be adjusted.
    • adjustColumnPreferredWidths

      public static void adjustColumnPreferredWidths(JTable table, boolean checkAllRows)
      Adjust the columns in the table to their preferred widths.
      Parameters:
      table - The table whose columns should be adjusted.
      checkAllRows - If false, only the preferred width of the column headers are considered.
    • adjustColumnPreferredWidth

      public static void adjustColumnPreferredWidth(JTable table, int col)
      Adjust one table column to its preferred width. This method considers the preferred width of the cells in all rows in addition to the column header.
      Parameters:
      table - The table whose columns should be adjusted.
      col - The column index.
    • adjustColumnPreferredWidth

      public static void adjustColumnPreferredWidth(JTable table, int col, boolean checkAllRows)
      Adjust one table column to its preferred width.
      Parameters:
      table - The table whose columns should be adjusted.
      col - The column index.
      checkAllRows - If false, only the preferred width of the column header is considered.