com.levigo.util.swing.table
Class JTableFormatter

java.lang.Object
  extended by com.levigo.util.swing.table.JTableFormatter

public class JTableFormatter
extends Object

A utility class that helps with JTable formatting, such as adjusting the column widths to their optimal value.

Version:
CVS $Revision$ $Date$
Author:
Daniela Gehle

Constructor Summary
JTableFormatter()
           
 
Method Summary
static void initColumnSizes(JTable table)
          Initializes the column sizes of the specified JTable to use the given space as smart as possible: Minimum width = heading width Preferred width = width of the widest cell content in each column If the sum of preferred cell widthes is wider than the available space, all columns will be cropped equally.
static void setColumnSizeToMaxCellWidth(JTable table, int col)
          Sets the column size of the specified column of the specified JTable to be as wide as the widest content of any of the cells in this column, or at least as wide as the heading of this column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JTableFormatter

public JTableFormatter()
Method Detail

initColumnSizes

public static void initColumnSizes(JTable table)
Initializes the column sizes of the specified JTable to use the given space as smart as possible: If the sum of preferred cell widthes is wider than the available space, all columns will be cropped equally.

Parameters:
table - the table to format

setColumnSizeToMaxCellWidth

public static void setColumnSizeToMaxCellWidth(JTable table,
                                               int col)
Sets the column size of the specified column of the specified JTable to be as wide as the widest content of any of the cells in this column, or at least as wide as the heading of this column.

Parameters:
table - the table to format
col - the column to set the width for


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.