public class TableAligner extends Object implements TableColumnModelListener
JTable. Expected usage:
JTable table = new JTable(...); TableAligner aligner = new TableAligner(table, SwingConstants.XXXX); table.getColumnModel().addColumnModelListener(aligner);
| Constructor and Description |
|---|
TableAligner(JTable table,
int alignment)
Creates a listener that installs alignment decorators on new columns added to
table. |
| Modifier and Type | Method and Description |
|---|---|
void |
columnAdded(TableColumnModelEvent e) |
void |
columnMarginChanged(ChangeEvent e) |
void |
columnMoved(TableColumnModelEvent e) |
void |
columnRemoved(TableColumnModelEvent e) |
void |
columnSelectionChanged(ListSelectionEvent e) |
static void |
installInAllColumns(JTable table,
int alignment)
Installs alignment decorators in all of the table's columns.
|
static void |
installInOneColumn(JTable table,
int colViewIndex,
int alignment)
Installs alignment decorators in the table column at
colViewIndex. |
public TableAligner(JTable table, int alignment)
table.
Also performs the initial alignment of table.table - a table.alignment - one of the following constants:
SwingConstants.LEFTSwingConstants.CENTER (the default for image-only labels)SwingConstants.RIGHTSwingConstants.LEADING (the default for text-only labels)SwingConstants.TRAILINGpublic static void installInAllColumns(JTable table, int alignment)
table - a table.alignment - one of the following constants:
SwingConstants.LEFTSwingConstants.CENTER (the default for image-only labels)SwingConstants.RIGHTSwingConstants.LEADING (the default for text-only labels)SwingConstants.TRAILINGpublic static void installInOneColumn(JTable table, int colViewIndex, int alignment)
colViewIndex.table - a table.colViewIndex - the index of the column in the table view.alignment - one of the following constants:
SwingConstants.LEFTSwingConstants.CENTER (the default for image-only labels)SwingConstants.RIGHTSwingConstants.LEADING (the default for text-only labels)SwingConstants.TRAILINGpublic void columnAdded(TableColumnModelEvent e)
columnAdded in interface TableColumnModelListenerpublic void columnRemoved(TableColumnModelEvent e)
columnRemoved in interface TableColumnModelListenerpublic void columnMoved(TableColumnModelEvent e)
columnMoved in interface TableColumnModelListenerpublic void columnMarginChanged(ChangeEvent e)
columnMarginChanged in interface TableColumnModelListenerpublic void columnSelectionChanged(ListSelectionEvent e)
columnSelectionChanged in interface TableColumnModelListenerCopyright © 1999–2014 UCAR/Unidata. All rights reserved.