|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sciapp.table.TableAssistant
public class TableAssistant
TableAssistant is a class that provides additional functions to a JTable. More specifically:
1) It automatically resizes the column of a table to the greatest preferred width of all cells under that column, when the column is double-clicked on its border.
2) Provides a popup through which the columns of the table can be dynamically added/removed. The popup is shown upon right-clicking on the table header.
| Constructor Summary | |
|---|---|
TableAssistant(JTable table)
Constructs a TableAssistant having table as the JTable on which this
object acts. |
|
| Method Summary | |
|---|---|
protected JPopupMenu |
createPopup()
|
void |
deselect(int modelIndex)
Unchecks the column with model index modelIndex from the column popup. |
JPopupMenu |
getColumnPopup()
Returns the popup menu displayed. |
boolean |
getShowPopup()
Returns true if the column popup is to be shown. |
void |
register(TableColumnModel tcm)
The component registers itself to the listener list of tcm. |
void |
resizeColumnToContents(int column)
Resizes the given column to its contents. |
void |
select(int modelIndex)
Checks the column with model index modelIndex from the column popup. |
void |
setHeader(JTableHeader newTableHeader)
Associates newTableHeader with this instance of TableAssistant. |
void |
setShowPopup(boolean showPopup)
Sets a flag that is true if the column popup is to be shown. |
void |
unregister(TableColumnModel tcm)
The component unregisters itself from the listener list of tcm. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TableAssistant(JTable table)
table as the JTable on which this
object acts.
table - the table| Method Detail |
|---|
protected JPopupMenu createPopup()
public void deselect(int modelIndex)
modelIndex from the column popup.
modelIndex - the model index of the table's columnpublic JPopupMenu getColumnPopup()
public boolean getShowPopup()
public void register(TableColumnModel tcm)
tcm.
tcm - the TableColumnModelpublic void resizeColumnToContents(int column)
column - the table column to resizepublic void select(int modelIndex)
modelIndex from the column popup.
modelIndex - the model index of the table's columnpublic void setHeader(JTableHeader newTableHeader)
newTableHeader with this instance of TableAssistant.
newTableHeader - the JTableHeader to associate with this TableAssistant.public void setShowPopup(boolean showPopup)
showPopup - the show popup value to setpublic void unregister(TableColumnModel tcm)
tcm.
tcm - the TableColumnModel
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||