public class JTableHeader extends JComponent implements TableColumnModelListener, Accessible
Modifier and Type | Class and Description |
---|---|
protected class |
JTableHeader.AccessibleJTableHeader |
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected TableColumnModel |
columnModel
The columnModel property.
|
protected TableColumn |
draggedColumn
The draggedColumn property.
|
protected int |
draggedDistance
The draggedDistance property.
|
protected boolean |
reorderingAllowed
The reorderingAllowed property.
|
protected boolean |
resizingAllowed
The resizingAllowed property.
|
protected TableColumn |
resizingColumn
The resizingColumn property.
|
protected JTable |
table
The table property.
|
protected boolean |
updateTableInRealTime
The updateTableInRealTime property.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
JTableHeader()
Creates a new default instance.
|
JTableHeader(TableColumnModel cm)
Creates a new header.
|
Modifier and Type | Method and Description |
---|---|
void |
columnAdded(TableColumnModelEvent event)
Receives notification when a column is added to the column model.
|
int |
columnAtPoint(Point point)
Returns the index of the column at the specified point.
|
void |
columnMarginChanged(ChangeEvent event)
Receives notification when a column margin changes in the column model.
|
void |
columnMoved(TableColumnModelEvent event)
Receives notification when a column is moved within the column model.
|
void |
columnRemoved(TableColumnModelEvent event)
Receives notification when a column is removed from the column model.
|
void |
columnSelectionChanged(ListSelectionEvent event)
Receives notification when the column selection has changed.
|
protected TableColumnModel |
createDefaultColumnModel()
Creates a default table column model.
|
protected TableCellRenderer |
createDefaultRenderer()
Creates a default renderer.
|
AccessibleContext |
getAccessibleContext()
Get the value of the
JComponent.accessibleContext property. |
TableColumnModel |
getColumnModel()
Get the value of the
columnModel property. |
TableCellRenderer |
getDefaultRenderer()
Returns the default table cell renderer.
|
TableColumn |
getDraggedColumn()
Get the column that is currently being dragged.
|
int |
getDraggedDistance()
Get the value of the
draggedDistance property. |
Rectangle |
getHeaderRect(int column)
Get the rectangle, occupied by the header of the given column.
|
boolean |
getReorderingAllowed()
Check if it is possible to reorder the table columns by dragging column
header with mouse.
|
boolean |
getResizingAllowed()
Check if it is possible to resize the table columns by dragging the column
boundary in the table header with mouse.
|
TableColumn |
getResizingColumn()
Get the column that is currently being resized.
|
JTable |
getTable()
Get the table, having this header.
|
TableHeaderUI |
getUI() |
String |
getUIClassID()
Get the value of the UIClassID property.
|
boolean |
getUpdateTableInRealTime()
Get the value of the
updateTableInRealTime property. |
protected void |
initializeLocalVars()
Initializes the fields and properties of this class with default values.
|
boolean |
isOpaque()
Get the value of the
opaque property. |
protected String |
paramString()
Return a string representation for this component, for use in
debugging.
|
void |
resizeAndRepaint()
Validates the layout of this table header and repaints it.
|
void |
setColumnModel(TableColumnModel c)
Set the value of the
columnModel property. |
void |
setDefaultRenderer(TableCellRenderer cellRenderer)
Sets the default table cell renderer.
|
void |
setDraggedColumn(TableColumn draggingIt)
Set the column that is currently being dragged.
|
void |
setDraggedDistance(int d)
Set the value of the
draggedDistance property. |
void |
setOpaque(boolean o)
Set the value of the
opaque property. |
void |
setReorderingAllowed(boolean allowed)
Set the table ability to reorder columns by dragging column header
with mouse.
|
void |
setResizingAllowed(boolean allowed)
Set the table ability to resize columns by dragging the column
boundary in the table header with mouse.
|
void |
setResizingColumn(TableColumn resizingIt)
The the column that is currently being resized.
|
void |
setTable(JTable t)
Set the value of the
table property. |
void |
setUI(TableHeaderUI u) |
void |
setUpdateTableInRealTime(boolean u)
Set the value of the
updateTableInRealTime property. |
void |
updateUI()
This method should be overridden in subclasses.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected TableColumnModel columnModel
protected TableColumn draggedColumn
protected int draggedDistance
protected boolean reorderingAllowed
protected boolean resizingAllowed
protected TableColumn resizingColumn
protected boolean updateTableInRealTime
public JTableHeader()
public JTableHeader(TableColumnModel cm)
cm
is null
, a new
table column model is created by calling
createDefaultColumnModel()
.cm
- the table column model (null
permitted).protected TableColumnModel createDefaultColumnModel()
public AccessibleContext getAccessibleContext()
JComponent.accessibleContext
property.getAccessibleContext
in interface Accessible
getAccessibleContext
in class JComponent
public TableColumnModel getColumnModel()
columnModel
property.public TableColumn getDraggedColumn()
public int getDraggedDistance()
draggedDistance
property.public boolean getReorderingAllowed()
setReorderingAllowed(boolean)
.public boolean getResizingAllowed()
setResizingAllowed(boolean)
.public TableColumn getResizingColumn()
public JTable getTable()
public boolean getUpdateTableInRealTime()
updateTableInRealTime
property.public boolean isOpaque()
opaque
property.isOpaque
in class JComponent
Component.isLightweight()
public void setColumnModel(TableColumnModel c)
columnModel
property.c
- The new value of the propertypublic void setDraggedColumn(TableColumn draggingIt)
draggingIt
- the column being currently dragged, null if none.public void setDraggedDistance(int d)
draggedDistance
property.d
- The new value of the propertypublic void setOpaque(boolean o)
opaque
property.setOpaque
in class JComponent
o
- The new value of the propertyComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
public void setReorderingAllowed(boolean allowed)
allowed
- true if reordering is allowed, false otherwise.public void setResizingAllowed(boolean allowed)
allowed
- true if resizing is allowed, false otherwise.public void setResizingColumn(TableColumn resizingIt)
resizingIt
- the column being currently resizedpublic void setTable(JTable t)
table
property.t
- The new value of the propertypublic void setUpdateTableInRealTime(boolean u)
updateTableInRealTime
property.u
- The new value of the propertyprotected TableCellRenderer createDefaultRenderer()
public TableCellRenderer getDefaultRenderer()
public void setDefaultRenderer(TableCellRenderer cellRenderer)
cellRenderer
- the renderer.public Rectangle getHeaderRect(int column)
column
- the column, for that the header area is requested.protected String paramString()
JComponent
paramString
in class JComponent
public String getUIClassID()
JComponent
UIDefaults
table managed by UIManager
, the
value of which is the name of a class to load for the component's
JComponent.ui
property.getUIClassID
in class JComponent
"ComponentUI"
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public TableHeaderUI getUI()
public void setUI(TableHeaderUI u)
public void updateUI()
JComponent
JComponent.getUIClassID()
) from the UIManager
, and calls JComponent.setUI(javax.swing.plaf.ComponentUI)
with the new delegate.updateUI
in class JComponent
public int columnAtPoint(Point point)
point
- the point.public void columnAdded(TableColumnModelEvent event)
columnAdded
in interface TableColumnModelListener
event
- the table column model eventpublic void columnMarginChanged(ChangeEvent event)
columnMarginChanged
in interface TableColumnModelListener
event
- the table column model eventpublic void columnMoved(TableColumnModelEvent event)
columnMoved
in interface TableColumnModelListener
event
- the table column model eventpublic void columnRemoved(TableColumnModelEvent event)
columnRemoved
in interface TableColumnModelListener
event
- the table column model eventpublic void columnSelectionChanged(ListSelectionEvent event)
columnSelectionChanged
in interface TableColumnModelListener
event
- the table column model eventpublic void resizeAndRepaint()
revalidate()
followed by
repaint()
.protected void initializeLocalVars()