|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.table.JTableHeader
This is the column header part of a JTable. I allow the user to change column widths and column ordering. I share the same TableColumnModel with a JTable.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
JTable
, Serialized FormInner Class Summary | |
protected class |
JTableHeader.AccessibleJTableHeader
The class used to obtain the accessible role for this object. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected TableColumnModel |
columnModel
The TableColumnModel of the table header |
protected TableColumn |
draggedColumn
The index of the column being dragged. |
protected int |
draggedDistance
The distance from its original position the column has been dragged |
protected boolean |
reorderingAllowed
Reordering of columns are allowed by the user |
protected boolean |
resizingAllowed
Resizing of columns are allowed by the user |
protected TableColumn |
resizingColumn
The index of the column being resized. |
protected JTable |
table
|
protected boolean |
updateTableInRealTime
If this flag is true, then the header will repaint the table as a column is dragged or resized. |
Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
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 |
Constructor Summary | |
JTableHeader()
Constructs a JTableHeader with a default TableColumnModel |
|
JTableHeader(TableColumnModel cm)
Constructs a JTableHeader which is initialized with cm as the column model. |
Method Summary | |
void |
columnAdded(TableColumnModelEvent e)
|
int |
columnAtPoint(Point point)
Returns the index of the column that point lies in, or -1 if it lies outside the receiver's bounds. |
void |
columnMarginChanged(ChangeEvent e)
|
void |
columnMoved(TableColumnModelEvent e)
|
void |
columnRemoved(TableColumnModelEvent e)
|
void |
columnSelectionChanged(ListSelectionEvent e)
|
protected TableColumnModel |
createDefaultColumnModel()
Returns the default column model object which is a DefaultTableColumnModel. |
AccessibleContext |
getAccessibleContext()
Get the AccessibleContext associated with this JComponent |
TableColumnModel |
getColumnModel()
Returns the TableColumnModel that contains all column inforamtion of this table header. |
TableColumn |
getDraggedColumn()
Returns the the dragged column, if and only if a drag is in process. |
int |
getDraggedDistance()
Returns the column's horizontal distance from its original position, if and only if a drag is in process. |
Rectangle |
getHeaderRect(int columnIndex)
Returns the rectangle containing the header tile at columnIndex. |
boolean |
getReorderingAllowed()
Returns true if the receiver allows the user to rearrange columns by dragging their headers, false otherwise. |
boolean |
getResizingAllowed()
Returns true if the receiver allows the user to resize columns by dragging between their headers, false otherwise. |
TableColumn |
getResizingColumn()
Returns the resizing column. |
JTable |
getTable()
Returns the header's partner table |
String |
getToolTipText(MouseEvent event)
Overriding to allow renderer's tips to be used if it has text set. |
TableHeaderUI |
getUI()
Returns the L&F object that renders this component. |
String |
getUIClassID()
Returns the name of the L&F class that renders this component. |
boolean |
getUpdateTableInRealTime()
Returns true if the receiver updates the body of the table view in real time when a column is resized or dragged. |
protected void |
initializeLocalVars()
|
protected String |
paramString()
Returns a string representation of this JTableHeader. |
void |
resizeAndRepaint()
Properly sizes the receiver and its header view, and marks it as needing display. |
void |
setColumnModel(TableColumnModel newModel)
Sets the column model for this table to newModel and registers with for listner notifications from the new column model. |
void |
setDraggedColumn(TableColumn aColumn)
Sets the header's draggedColumn to aColumn |
void |
setDraggedDistance(int distance)
Sets the header's draggedDistance to distance |
void |
setReorderingAllowed(boolean b)
Sets whether the user can drag column headers to reorder columns. |
void |
setResizingAllowed(boolean b)
Sets whether the user can resize columns by dragging between headers. |
void |
setResizingColumn(TableColumn aColumn)
Sets the header's resizingColumn to aColumn |
void |
setTable(JTable aTable)
Sets the header's partner table to aTable |
void |
setUI(TableHeaderUI ui)
Sets the L&F object that renders this component. |
void |
setUpdateTableInRealTime(boolean flag)
Sets whether the body of the table updates in real time when a column is resized or dragged. |
void |
updateUI()
Notification from the UIManager that the L&F has changed. |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected JTable table
protected TableColumnModel columnModel
protected boolean reorderingAllowed
protected boolean resizingAllowed
protected boolean updateTableInRealTime
protected transient TableColumn resizingColumn
protected transient TableColumn draggedColumn
protected transient int draggedDistance
Constructor Detail |
public JTableHeader()
createDefaultColumnModel()
public JTableHeader(TableColumnModel cm)
cm
- The column model for the tablecreateDefaultColumnModel()
Method Detail |
public void setTable(JTable aTable)
public JTable getTable()
public void setReorderingAllowed(boolean b)
flag
- true if the table view should allow
reorderinggetReorderingAllowed()
public boolean getReorderingAllowed()
setReorderingAllowed(boolean)
public void setResizingAllowed(boolean b)
flag
- true if table view should allow
resizinggetResizingAllowed()
public boolean getResizingAllowed()
setResizingAllowed(boolean)
public TableColumn getDraggedColumn()
getDraggedDistance()
public int getDraggedDistance()
getDraggedColumn()
public TableColumn getResizingColumn()
public void setUpdateTableInRealTime(boolean flag)
flag
- true if tableView should update
the body of the table in real timegetUpdateTableInRealTime()
public boolean getUpdateTableInRealTime()
setUpdateTableInRealTime(boolean)
public int columnAtPoint(Point point)
public Rectangle getHeaderRect(int columnIndex)
public String getToolTipText(MouseEvent event)
public TableHeaderUI getUI()
public void setUI(TableHeaderUI ui)
ui
- the TableHeaderUI L&F objectUIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
JComponent.updateUI()
public String getUIClassID()
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void setColumnModel(TableColumnModel newModel)
newModel
- the new data source for this tablegetColumnModel()
public TableColumnModel getColumnModel()
#setColumnModel()
public void columnAdded(TableColumnModelEvent e)
public void columnRemoved(TableColumnModelEvent e)
public void columnMoved(TableColumnModelEvent e)
public void columnMarginChanged(ChangeEvent e)
public void columnSelectionChanged(ListSelectionEvent e)
protected TableColumnModel createDefaultColumnModel()
protected void initializeLocalVars()
public void resizeAndRepaint()
public void setDraggedColumn(TableColumn aColumn)
public void setDraggedDistance(int distance)
public void setResizingColumn(TableColumn aColumn)
protected String paramString()
null
.
Overriding paramString() to provide information about the specific new aspects of the JFC components.
public AccessibleContext getAccessibleContext()
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |