| 
 | Jadex 0.96-beta1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.table.JTableHeader
jadex.util.jtable.ResizeableTableHeader
public class ResizeableTableHeader
This subclass of JTableHeader extends a JTable
 with the ability to resize a column to fit all its content on double click
 on the right end of the column's header cell. 
Note that you have to set the tableheader's columnmodel to the columnmodel of the table. See example for usage:
JTable table; ResizeableTableHeader tableHeader; // create new table table= new JTable(); // create new ResizableTableHeader with the table's ColumnModel tableHeader = new ResizeableTableHeader(table.getColumnModel()); // set the new header for the table table.setTableHeader(tableHeader);Or for the one line fans
// create new table JTable table= new JTable(); table.setTableHeader(new ResizeableTableHeader(table.getColumnModel()));
| Nested Class Summary | 
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent | 
|---|
| JComponent.AccessibleJComponent | 
| Field Summary | 
|---|
| Fields inherited from class javax.swing.JComponent | 
|---|
| TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW | 
| Fields inherited from class java.awt.Component | 
|---|
| BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT | 
| Fields inherited from interface java.awt.image.ImageObserver | 
|---|
| ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH | 
| Constructor Summary | |
|---|---|
| ResizeableTableHeader()Constructs a ResizeableTableHeaderwith a defaultTableColumnModel. | |
| ResizeableTableHeader(TableColumnModel cm)Constructs a ResizeableTableHeaderwhich is initialized withcmas the column model. | |
| Method Summary | |
|---|---|
|  boolean | getAutoResizingEnabled()Returns true if auto resizing is enabled. | 
|  boolean | getIncludeHeaderWidth()Returns true, if the header's width are | 
|  void | resizeAllColumns()Resizes all columns to fit all their content. | 
|  void | resizeColumn(TableColumn column)Resizes the given column to fit all its content. | 
|  void | setAllColumnWidths(int preferredWidth,
                   int minWidth,
                   int maxWidth)Sets preferred width, the minimum and maximum width for all columns. | 
|  void | setAutoResizingEnabled(boolean autoResizingEnabled)Sets whether columns are resized on table model events. | 
|  void | setColumnWidths(TableColumn column,
                int preferredWidth,
                int minWidth,
                int maxWidth)Sets preferred width, the minimum and maximum width for a given column. | 
|  void | setIncludeHeaderWidth(boolean includeHeaderWidth)Sets whether the header's width are included on calculation | 
|  void | setTable(JTable table)Sets the table associated with this header. | 
|  void | tableChanged(TableModelEvent e)Listen for table model events from tablemodel. | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public ResizeableTableHeader()
ResizeableTableHeader with a default
  TableColumnModel.
public ResizeableTableHeader(TableColumnModel cm)
ResizeableTableHeader which is initialized with
  cm as the column model.  If cm is
  null this method will initialize the table header
  with a default TableColumnModel.
cm - the column model for the table| Method Detail | 
|---|
public void setTable(JTable table)
setTable in class JTableHeadertable - the new tablepublic void setAutoResizingEnabled(boolean autoResizingEnabled)
autoResizingEnabled - true if columns are resized automaticallygetAutoResizingEnabled()public boolean getAutoResizingEnabled()
autoResizingEnabled propertysetAutoResizingEnabled(boolean)public void setIncludeHeaderWidth(boolean includeHeaderWidth)
includeHeaderWidth - true if the headers are includedgetIncludeHeaderWidth()public boolean getIncludeHeaderWidth()
setIncludeHeaderWidth propertysetIncludeHeaderWidth(boolean)public void resizeColumn(TableColumn column)
column - The  TableColumn to resize.public void resizeAllColumns()
public void setColumnWidths(TableColumn column,
                            int preferredWidth,
                            int minWidth,
                            int maxWidth)
column - The TableColumn to change.preferredWidth - The preferred width of the column.minWidth - The minimum width of the column.maxWidth - The maximum width of the column.setAllColumnWidths(int preferredWidth, int minWidth, int maxWidth)
public void setAllColumnWidths(int preferredWidth,
                               int minWidth,
                               int maxWidth)
preferredWidth - The preferred width of the column.minWidth - The minimum width of the column.maxWidth - The maximum width of the column.setColumnWidths(javax.swing.table.TableColumn column,int preferredWidth, int minWidth, int maxWidth)public void tableChanged(TableModelEvent e)
resizeAllColumns().
tableChanged in interface TableModelListenere - The TableModelEvent| 
 | Jadex 0.96-beta1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.