Home » openjdk-7 » javax » swing » table » [javadoc | source]
javax.swing.table
public class: JTableHeader [javadoc | source]
java.lang.Object
   java.awt.Component
      java.awt.Container
         javax.swing.JComponent
            javax.swing.table.JTableHeader

All Implemented Interfaces:
    TableColumnModelListener, Accessible, HasGetTransferHandler, Serializable, MenuContainer, ImageObserver

This is the object which manages the header of the 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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Nested Class Summary:
protected class  JTableHeader.AccessibleJTableHeader  This class implements accessibility support for the JTableHeader class. It provides an implementation of the Java Accessibility API appropriate to table header user-interface elements.

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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}. 

Field Summary
protected  JTable table    The table for which this object is the header; the default is null
protected  TableColumnModel columnModel    The TableColumnModel of the table header. 
protected  boolean reorderingAllowed    If true, reordering of columns are allowed by the user; the default is true. 
protected  boolean resizingAllowed    If true, resizing of columns are allowed by the user; the default is true. 
protected  boolean updateTableInRealTime    Obsolete as of Java 2 platform v1.3. Real time repaints, in response to column dragging or resizing, are now unconditional. 
protected transient  TableColumn resizingColumn    The index of the column being resized. null if not resizing. 
protected transient  TableColumn draggedColumn    The index of the column being dragged. null if not dragging. 
protected transient  int draggedDistance    The distance from its original position the column has been dragged. 
Fields inherited from javax.swing.JComponent:
DEBUG_GRAPHICS_LOADED,  ui,  listenerList,  paintingChild,  WHEN_FOCUSED,  WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,  WHEN_IN_FOCUSED_WINDOW,  UNDEFINED_CONDITION,  TOOL_TIP_TEXT_KEY,  focusController,  accessibleContext
Fields inherited from java.awt.Container:
layoutMgr,  containerListener,  listeningChildren,  listeningBoundsChildren,  descendantsCount,  preserveBackgroundColor,  INCLUDE_SELF,  SEARCH_HEAVYWEIGHTS,  modalComp,  modalAppContext
Fields inherited from java.awt.Component:
peer,  parent,  appContext,  x,  y,  width,  height,  foreground,  background,  font,  peerFont,  cursor,  locale,  bufferStrategy,  ignoreRepaint,  visible,  enabled,  dropTarget,  popups,  focusTraversalKeys,  LOCK,  minSize,  minSizeSet,  prefSize,  prefSizeSet,  maxSize,  maxSizeSet,  componentOrientation,  newEventsOnly,  componentListener,  focusListener,  hierarchyListener,  hierarchyBoundsListener,  keyListener,  mouseListener,  mouseMotionListener,  mouseWheelListener,  inputMethodListener,  windowClosingException,  actionListenerK,  adjustmentListenerK,  componentListenerK,  containerListenerK,  focusListenerK,  itemListenerK,  keyListenerK,  mouseListenerK,  mouseMotionListenerK,  mouseWheelListenerK,  textListenerK,  ownedWindowK,  windowListenerK,  inputMethodListenerK,  hierarchyListenerK,  hierarchyBoundsListenerK,  windowStateListenerK,  windowFocusListenerK,  eventMask,  isInc,  incRate,  TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT,  isPacked,  backgroundEraseDisabled,  eventCache,  accessibleContext
Constructor:
 public JTableHeader() 
 public JTableHeader(TableColumnModel cm) 
    Constructs a JTableHeader which is initialized with cm as the column model. If cm is null this method will initialize the table header with a default TableColumnModel.
Method from javax.swing.table.JTableHeader Summary:
columnAdded,   columnAtPoint,   columnMarginChanged,   columnMoved,   columnRemoved,   columnSelectionChanged,   createDefaultColumnModel,   createDefaultRenderer,   getAccessibleContext,   getColumnModel,   getDefaultRenderer,   getDraggedColumn,   getDraggedDistance,   getHeaderRect,   getReorderingAllowed,   getResizingAllowed,   getResizingColumn,   getTable,   getToolTipText,   getUI,   getUIClassID,   getUpdateTableInRealTime,   initializeLocalVars,   paramString,   resizeAndRepaint,   setColumnModel,   setDefaultRenderer,   setDraggedColumn,   setDraggedDistance,   setReorderingAllowed,   setResizingAllowed,   setResizingColumn,   setTable,   setUI,   setUpdateTableInRealTime,   updateUI
Methods from javax.swing.JComponent:
_paintImmediately,   addAncestorListener,   addNotify,   addVetoableChangeListener,   alwaysOnTop,   checkIfChildObscuredBySibling,   clientPropertyChanged,   compWriteObjectNotify,   componentInputMapChanged,   computeVisibleRect,   computeVisibleRect,   contains,   createToolTip,   disable,   dndDone,   dropLocationForPoint,   enable,   firePropertyChange,   firePropertyChange,   firePropertyChange,   fireVetoableChange,   getAccessibleContext,   getActionForKeyStroke,   getActionMap,   getActionMap,   getAlignmentX,   getAlignmentY,   getAncestorListeners,   getAutoscrolls,   getBaseline,   getBaselineResizeBehavior,   getBorder,   getBounds,   getClientProperty,   getComponentGraphics,   getComponentPopupMenu,   getConditionForKeyStroke,   getCreatedDoubleBuffer,   getDebugGraphicsOptions,   getDefaultLocale,   getFontMetrics,   getGraphics,   getGraphicsInvoked,   getHeight,   getInheritsPopupMenu,   getInputMap,   getInputMap,   getInputMap,   getInputVerifier,   getInsets,   getInsets,   getListeners,   getLocation,   getManagingFocusBackwardTraversalKeys,   getManagingFocusForwardTraversalKeys,   getMaximumSize,   getMinimumSize,   getNextFocusableComponent,   getPopupLocation,   getPreferredSize,   getRegisteredKeyStrokes,   getRootPane,   getSize,   getToolTipLocation,   getToolTipText,   getToolTipText,   getTopLevelAncestor,   getTransferHandler,   getUIClassID,   getVerifyInputWhenFocusTarget,   getVetoableChangeListeners,   getVisibleRect,   getWidth,   getWriteObjCounter,   getX,   getY,   grabFocus,   isDoubleBuffered,   isLightweightComponent,   isManagingFocus,   isOpaque,   isOptimizedDrawingEnabled,   isPainting,   isPaintingForPrint,   isPaintingOrigin,   isPaintingTile,   isRequestFocusEnabled,   isValidateRoot,   paint,   paintBorder,   paintChildren,   paintComponent,   paintForceDoubleBuffered,   paintImmediately,   paintImmediately,   paintToOffscreen,   paramString,   print,   printAll,   printBorder,   printChildren,   printComponent,   processComponentKeyEvent,   processKeyBinding,   processKeyBindings,   processKeyBindingsForAllComponents,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   putClientProperty,   rectangleIsObscured,   registerKeyboardAction,   registerKeyboardAction,   removeAncestorListener,   removeNotify,   removeVetoableChangeListener,   repaint,   repaint,   requestDefaultFocus,   requestFocus,   requestFocus,   requestFocusInWindow,   requestFocusInWindow,   resetKeyboardActions,   reshape,   revalidate,   safelyGetGraphics,   safelyGetGraphics,   scrollRectToVisible,   setActionMap,   setAlignmentX,   setAlignmentY,   setAutoscrolls,   setBackground,   setBorder,   setComponentPopupMenu,   setCreatedDoubleBuffer,   setDebugGraphicsOptions,   setDefaultLocale,   setDoubleBuffered,   setDropLocation,   setEnabled,   setFocusTraversalKeys,   setFont,   setForeground,   setInheritsPopupMenu,   setInputMap,   setInputVerifier,   setMaximumSize,   setMinimumSize,   setNextFocusableComponent,   setOpaque,   setPaintingChild,   setPreferredSize,   setRequestFocusEnabled,   setToolTipText,   setTransferHandler,   setUI,   setUIProperty,   setVerifyInputWhenFocusTarget,   setVisible,   setWriteObjCounter,   shouldDebugGraphics,   superProcessMouseMotionEvent,   unregisterKeyboardAction,   update,   updateUI
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addImpl,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustDecendantsOnParent,   adjustDescendants,   adjustListeningChildren,   applyComponentOrientation,   areFocusTraversalKeysSet,   canContainFocusOwner,   checkGD,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   containsFocus,   countComponents,   countHierarchyMembers,   createChildHierarchyEvents,   createHierarchyEvents,   decreaseComponentCount,   deliverEvent,   dispatchEventImpl,   dispatchEventToSelf,   doLayout,   eventEnabled,   findComponentAt,   findComponentAt,   findComponentAt,   findComponentAtImpl,   getAccessibleAt,   getAccessibleChild,   getAccessibleChildrenCount,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   getComponentsSync,   getComponents_NoClientCode,   getContainerListeners,   getDropTargetEventTarget,   getFocusTraversalKeys,   getFocusTraversalPolicy,   getHeavyweightContainer,   getInsets,   getLayout,   getListeners,   getMaximumSize,   getMinimumSize,   getMouseEventTarget,   getMousePosition,   getOpaqueShape,   getPreferredSize,   getTraversalRoot,   hasHeavyweightDescendants,   hasLightweightDescendants,   increaseComponentCount,   initializeFocusTraversalKeys,   insets,   invalidate,   invalidateParent,   invalidateTree,   isAncestorOf,   isFocusCycleRoot,   isFocusCycleRoot,   isFocusTraversalPolicyProvider,   isFocusTraversalPolicySet,   isRecursivelyVisibleUpToHeavyweightContainer,   isSameOrAncestorOf,   isValidateRoot,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   locate,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   numListening,   paint,   paintComponents,   paintHeavyweightComponents,   paramString,   postProcessKeyEvent,   postsOldMouseEvents,   preProcessKeyEvent,   preferredSize,   print,   printComponents,   printHeavyweightComponents,   processContainerEvent,   processEvent,   proxyEnableEvents,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusDownCycle,   update,   updateGraphicsData,   validate,   validateTree,   validateUnconditionally
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustListeningChildrenOnParent,   applyComponentOrientation,   applyCompoundShape,   applyCurrentShape,   areBoundsValid,   areFocusTraversalKeysSet,   areInputMethodsEnabled,   autoProcessMouseWheel,   bounds,   canBeFocusOwner,   canBeFocusOwnerRecursively,   checkGD,   checkImage,   checkImage,   checkTreeLock,   checkWindowClosingException,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   coalesceEvents,   constructComponentName,   contains,   contains,   containsFocus,   countHierarchyMembers,   createBufferStrategy,   createBufferStrategy,   createHierarchyEvents,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventEnabled,   eventTypeEnabled,   findUnderMouseInWindow,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessControlContext,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getAlignmentX,   getAlignmentY,   getBackBuffer,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getBoundsOp,   getBufferStrategy,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getContainer,   getContainingWindow,   getCursor,   getCursor_NoClientCode,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFocusTraversalKeys_NoIDCheck,   getFont,   getFontMetrics,   getFont_NoClientCode,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfiguration_NoClientCode,   getGraphics_NoClientCode,   getHWPeerAboveMe,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getLocationOnScreen_NoTreeLock,   getLocationOnWindow,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getNativeContainer,   getNextFocusCandidate,   getNormalShape,   getObjectLock,   getOpaqueShape,   getParent,   getParent_NoClientCode,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSiblingIndexAbove,   getSiblingIndexBelow,   getSize,   getSize,   getToolkit,   getToolkitImpl,   getTraversalRoot,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   initializeFocusTraversalKeys,   inside,   invalidate,   invalidateIfValid,   invalidateParent,   isAutoFocusTransferOnDisposal,   isBackgroundSet,   isCoalescingEnabled,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isEnabledImpl,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusTraversableOverridden,   isFocusable,   isFontSet,   isForegroundSet,   isInstanceOf,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isMixingNeeded,   isNonOpaqueForMixing,   isOpaque,   isPreferredSizeSet,   isRecursivelyVisible,   isSameOrAncestorOf,   isShowing,   isValid,   isVisible,   isVisible_NoClientCode,   keyDown,   keyUp,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   numListening,   paint,   paintAll,   paintHeavyweightComponents,   paramString,   pointRelativeToComponent,   postEvent,   postsOldMouseEvents,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   printHeavyweightComponents,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   relocateComponent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocus,   requestFocus,   requestFocusHelper,   requestFocusHelper,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   revalidate,   setAutoFocusTransferOnDisposal,   setBackground,   setBounds,   setBounds,   setBoundsOp,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusTraversalKeys_NoIDCheck,   setFocusable,   setFont,   setForeground,   setGraphicsConfiguration,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setRequestFocusController,   setSize,   setSize,   setVisible,   show,   show,   size,   subtractAndApplyShape,   subtractAndApplyShapeBelowMe,   toString,   transferFocus,   transferFocus,   transferFocusBackward,   transferFocusBackward,   transferFocusUpCycle,   update,   updateCursorImmediately,   updateGraphicsData,   updateZOrder,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.table.JTableHeader Detail:
 public  void columnAdded(TableColumnModelEvent e) 
    Invoked when a column is added to the table column model.

    Application code will not use these methods explicitly, they are used internally by JTable.

 public int columnAtPoint(Point point) 
    Returns the index of the column that point lies in, or -1 if it lies out of bounds.
 public  void columnMarginChanged(ChangeEvent e) 
    Invoked when a column is moved due to a margin change.

    Application code will not use these methods explicitly, they are used internally by JTable.

 public  void columnMoved(TableColumnModelEvent e) 
    Invoked when a column is repositioned.

    Application code will not use these methods explicitly, they are used internally by JTable.

 public  void columnRemoved(TableColumnModelEvent e) 
    Invoked when a column is removed from the table column model.

    Application code will not use these methods explicitly, they are used internally by JTable.

 public  void columnSelectionChanged(ListSelectionEvent e) 
    Invoked when the selection model of the TableColumnModel is changed. This method currently has no effect (the header is not redrawn).

    Application code will not use these methods explicitly, they are used internally by JTable.

 protected TableColumnModel createDefaultColumnModel() 
    Returns the default column model object which is a DefaultTableColumnModel. A subclass can override this method to return a different column model object
 protected TableCellRenderer createDefaultRenderer() 
    Returns a default renderer to be used when no header renderer is defined by a TableColumn.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this JTableHeader. For JTableHeaders, the AccessibleContext takes the form of an AccessibleJTableHeader. A new AccessibleJTableHeader instance is created if necessary.
 public TableColumnModel getColumnModel() 
    Returns the TableColumnModel that contains all column information of this table header.
 public TableCellRenderer getDefaultRenderer() 
    Returns the default renderer used when no headerRenderer is defined by a TableColumn.
 public TableColumn getDraggedColumn() 
    Returns the the dragged column, if and only if, a drag is in process, otherwise returns null.
 public int getDraggedDistance() 
    Returns the column's horizontal distance from its original position, if and only if, a drag is in process. Otherwise, the the return value is meaningless.
 public Rectangle getHeaderRect(int column) 
    Returns the rectangle containing the header tile at column. When the column parameter is out of bounds this method uses the same conventions as the JTable method getCellRect.
 public boolean getReorderingAllowed() 
    Returns true if the user is allowed to rearrange columns by dragging their headers, false otherwise. The default is true. You can rearrange columns programmatically regardless of this setting.
 public boolean getResizingAllowed() 
    Returns true if the user is allowed to resize columns by dragging between their headers, false otherwise. The default is true. You can resize columns programmatically regardless of this setting.
 public TableColumn getResizingColumn() 
    Returns the resizing column. If no column is being resized this method returns null.
 public JTable getTable() 
    Returns the table associated with this header.
 public String getToolTipText(MouseEvent event) 
    Allows the renderer's tips to be used if there is text set.
 public TableHeaderUI getUI() 
    Returns the look and feel (L&F) object that renders this component.
 public String getUIClassID() 
    Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
 public boolean getUpdateTableInRealTime() 
    Obsolete as of Java 2 platform v1.3. Real time repaints, in response to column dragging or resizing, are now unconditional.
 protected  void initializeLocalVars() 
    Initializes the local variables and properties with default values. Used by the constructor methods.
 protected String paramString() 
    Returns a string representation of this JTableHeader. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

    Overriding paramString to provide information about the specific new aspects of the JFC components.

 public  void resizeAndRepaint() 
    Sizes the header and marks it as needing display. Equivalent to revalidate followed by repaint.
 public  void setColumnModel(TableColumnModel columnModel) 
    Sets the column model for this table to newModel and registers for listener notifications from the new column model.
 public  void setDefaultRenderer(TableCellRenderer defaultRenderer) 
    Sets the default renderer to be used when no headerRenderer is defined by a TableColumn.
 public  void setDraggedColumn(TableColumn aColumn) 
    Sets the header's draggedColumn to aColumn.

    Application code will not use this method explicitly, it is used internally by the column dragging mechanism.

 public  void setDraggedDistance(int distance) 
    Sets the header's draggedDistance to distance.
 public  void setReorderingAllowed(boolean reorderingAllowed) 
    Sets whether the user can drag column headers to reorder columns.
 public  void setResizingAllowed(boolean resizingAllowed) 
    Sets whether the user can resize columns by dragging between headers.
 public  void setResizingColumn(TableColumn aColumn) 
    Sets the header's resizingColumn to aColumn.

    Application code will not use this method explicitly, it is used internally by the column sizing mechanism.

 public  void setTable(JTable table) 
    Sets the table associated with this header.
 public  void setUI(TableHeaderUI ui) 
    Sets the look and feel (L&F) object that renders this component.
 public  void setUpdateTableInRealTime(boolean flag) 
    Obsolete as of Java 2 platform v1.3. Real time repaints, in response to column dragging or resizing, are now unconditional.
 public  void updateUI() 
    Notification from the UIManager that the look and feel (L&F) has changed. Replaces the current UI object with the latest version from the UIManager.