com.levigo.util.swing.table
Class JTableRowHeader

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.levigo.util.swing.table.JTableRowHeader
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable

public class JTableRowHeader
extends JComponent

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. A future release of Swing will provide support for long term persistence.

Version:
1.54 03/15/00
Author:
Alan Chung, Philip Milne
See Also:
JTable, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean resizingAllowed
          If true, resizing of rows are allowed by the user; the default is true.
protected  JTable table
          The table for which this object is the header; the default is null.
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JTableRowHeader()
          Constructs a JTableHeader with a default TablerowModel.
 
Method Summary
protected  TableCellRenderer createDefaultRenderer()
          Returns a default renderer to be used when no header renderer is defined by a TableColumn.
 int getCellHeight()
           
 TableCellRenderer getDefaultRenderer()
          Returns the default renderer used when no headerRenderer is defined by a TableColumn.
 Rectangle getHeaderRect(int row)
          Returns the rectangle containing the header tile at row.
 boolean getResizingAllowed()
          Returns true if the user is allowed to resize columns by dragging between their headers, false otherwise.
 JTable getTable()
          Returns the table associated with this header.
 TableModel getTableModel()
          Returns the table model associated with this header.
 String getToolTipText(MouseEvent event)
          Allows the renderer's tips to be used if there is text set.
 TableHeaderUI getUI()
          Returns the look and feel (L&F) object that renders this component.
 String getUIClassID()
          Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
protected  void initializeLocalVars()
          Initializes the local variables and properties with default values.
protected  String paramString()
          Returns a string representation of this JTableHeader.
 void resizeAndRepaint()
          Sizes the header and marks it as needing display.
 int rowAtPoint(Point point)
          Returns the index of the row that point lies in, or -1 if it lies out of bounds.
 void setDefaultRenderer(TableCellRenderer defaultRenderer)
          Sets the default renderer to be used when no headerRenderer is defined by a TabelColumn.
 void setResizingAllowed(boolean resizingAllowed)
          Sets whether the user can resize rows by dragging between headers.
 void setTable(JTable table)
          Sets the table associated with this header.
 void setUI(TableHeaderUI ui)
          Sets the look and feel (L&F) object that renders this component.
 void updateUI()
          Notification from the UIManager that the look and feel (L&F) has changed.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, 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, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
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, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, 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, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

resizingAllowed

protected boolean resizingAllowed
If true, resizing of rows are allowed by the user; the default is true.


table

protected JTable table
The table for which this object is the header; the default is null.

Constructor Detail

JTableRowHeader

public JTableRowHeader()
Constructs a JTableHeader with a default TablerowModel.

Method Detail

setTable

public void setTable(JTable table)
Sets the table associated with this header.

Parameters:
table - the new table

getTableModel

public TableModel getTableModel()
Returns the table model associated with this header.

Returns:
the TableModel property

setResizingAllowed

public void setResizingAllowed(boolean resizingAllowed)
Sets whether the user can resize rows by dragging between headers.

Parameters:
resizingAllowed - true if table view should allow resizing
See Also:
getResizingAllowed()

setDefaultRenderer

public void setDefaultRenderer(TableCellRenderer defaultRenderer)
Sets the default renderer to be used when no headerRenderer is defined by a TabelColumn.

Parameters:
defaultRenderer - the default renderer

getDefaultRenderer

public TableCellRenderer getDefaultRenderer()
Returns the default renderer used when no headerRenderer is defined by a TableColumn.

Returns:
the default renderer

getCellHeight

public int getCellHeight()

rowAtPoint

public int rowAtPoint(Point point)
Returns the index of the row that point lies in, or -1 if it lies out of bounds.

Returns:
the index of the row that point lies in, or -1 if it lies out of bounds

getHeaderRect

public Rectangle getHeaderRect(int row)
Returns the rectangle containing the header tile at row. When the row parameter is out of bounds this method uses the same conventions as the JTable method getCellRect.

Returns:
the rectangle containing the header tile at row
See Also:
JTable.getCellRect(int, int, boolean)

getToolTipText

public String getToolTipText(MouseEvent event)
Allows the renderer's tips to be used if there is text set.

Overrides:
getToolTipText in class JComponent
Parameters:
event - the location of the event identifies the proper renderer and, therefore, the proper tip
Returns:
the tool tip for this component

getUI

public TableHeaderUI getUI()
Returns the look and feel (L&F) object that renders this component.

Returns:
the TableHeaderUI object that renders this component

setUI

public void setUI(TableHeaderUI ui)
Sets the look and feel (L&F) object that renders this component.

Parameters:
ui - the TableHeaderUI L&F object
See Also:
UIDefaults.getUI(javax.swing.JComponent)

updateUI

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.

Overrides:
updateUI in class JComponent
See Also:
JComponent.updateUI()

getUIClassID

public String getUIClassID()
Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.

Overrides:
getUIClassID in class JComponent
Returns:
the string "TableHeaderUI"
See Also:
JComponent.getUIClassID(), UIDefaults.getUI(javax.swing.JComponent)

createDefaultRenderer

protected TableCellRenderer createDefaultRenderer()
Returns a default renderer to be used when no header renderer is defined by a TableColumn.


initializeLocalVars

protected void initializeLocalVars()
Initializes the local variables and properties with default values. Used by the constructor methods.


resizeAndRepaint

public void resizeAndRepaint()
Sizes the header and marks it as needing display. Equivalent to revalidate followed by repaint.


paramString

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.

Overrides:
paramString in class JComponent
Returns:
a string representation of this JTableHeader

getTable

public JTable getTable()
Returns the table associated with this header.

Returns:
the table property

getResizingAllowed

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.

Returns:
the resizingAllowed property
See Also:
setResizingAllowed(boolean)


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.