Class TableUtils


  • public class TableUtils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MIN_COLUMN_WIDTH  
    • Constructor Summary

      Constructors 
      Constructor Description
      TableUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void installColumnWidthSavers​(javax.swing.JTable table, java.util.prefs.Preferences prefs, java.lang.String prefKey)
      Installs listeners on each column of the table as well as the table itself that save and restore the table's column widths.
      static void setColumnAlignment​(ColumnAlignable tableModel, javax.swing.JTable table)
      Sets the horizontal alignment of each of the columns of the specified table..
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TableUtils

        public TableUtils()
    • Method Detail

      • setColumnAlignment

        public static void setColumnAlignment​(ColumnAlignable tableModel,
                                              javax.swing.JTable table)
        Sets the horizontal alignment of each of the columns of the specified table..
        Parameters:
        tableModel - - the table model for the table. Must implement ColumnAlignable.
        table - - the table whose columns' horizontal alignment is to be set
      • installColumnWidthSavers

        public static void installColumnWidthSavers​(javax.swing.JTable table,
                                                    java.util.prefs.Preferences prefs,
                                                    java.lang.String prefKey)
        Installs listeners on each column of the table as well as the table itself that save and restore the table's column widths. If the table's TableModel implements ColumnWidthSaveable, the restored column widths will be a combination of fixed and proportionally allocated to the table's total width based upon the values returned by the model's getColumnWidthTypes() method. Otherwise, all columns will be proportionally allocated to the table's total width.
        Parameters:
        table - - the table whose columns' widths are to be saved/restored
        prefs - - the Preferences node where the widths are stored/retrieved
        prefKey - - the key prefix for the particular table