borland Packages  Class Hierarchy  dbswing Package 

TableRowHeader component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----javax.swing.JComponent
                           +----com.borland.dbswing.TableRowHeader

About the TableRowHeader component

Variables  Constructors  Properties  Methods  Event Listeners

Implements ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, TableModelListener

Note: This is a feature of JBuilder Professional and Enterprise.

TableRowHeader is intended to be placed within a JScrollPane's row header area to display information about the rows of a JTable in the JScrollPane's main viewport. When placed into a JScrollPane's row header view, TableRowHeader gets the JScrollPane's viewport view component and uses that as the value of its table property if it is a JTable. TableRowHeader requires its table property to be set to display properly.

JdbTable uses this component by default to display its row header.

TableRowHeader uses its corresponding JTable's TableModel as its own model, unless another TableModel has been explicitly specified. If neither a TableModel nor a JTable have been specified, then an empty DefaultTableModel is used by default.

TableRowHeader optionally allows vertical resizing of the first visible row's header cell to adjust its corresponding JTable's row height.

TableRowHeader delegates rendering of each row's header cell to its TableCellRenderer. If a renderer is not explicitly specified, a TableRowNoRenderer is used by default. The value parameter passed to the TableCellRenderer's getTableCellRendererComponent() method is always its instance of TableRowHeader, which the renderer can invalidate to cause a repaint. The renderer can obtain information about its table from either the table or row parameter. The column parameter is passed one of the following values, which a renderer may take advantage of to increase performance:

TableRowHeader values passed to renderer

Value Meaning
TableRowHeader.PAINT Renderer is about to be asked to paint
TableRowHeader.PREF_SIZE Renderer is being asked its preferred size
TableRowHeader.MIN_SIZE Renderer is being asked its minimum size
TableRowHeader.MAX_SIZE Renderer is being asked its maximum size

Example:

JTable jTable = new JTable(20, 10); // an empty JTable with 20 rows and 10 columns
JScrollPane jScrollPane = new JScrollPane(jTable);
jScrollPane.setRowHeaderView(new TableRowHeader());

TableRowHeader variables

Variables implemented in this class

Variables implemented in java.awt.Component

Variables implemented in javax.swing.JComponent

TableRowHeader constructors

TableRowHeader properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

Properties implemented in javax.swing.JComponent

TableRowHeader methods

Methods implemented in this class

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

Methods implemented in javax.swing.JComponent

TableRowHeader event listeners


TableRowHeader variables

MAX_SIZE

  public static final int MAX_SIZE = 3
Column index passed to renderer when asked its maximum size.

MIN_SIZE

  public static final int MIN_SIZE = 2
Column index passed to renderer when asked its minimum size.

PAINT

  public static final int PAINT = 0
Column index passed to renderer when about to paint.

PREF_SIZE

  public static final int PREF_SIZE = 1
Column index passed to renderer when asked its preferred size.

TableRowHeader constructors

TableRowHeader()

  public TableRowHeader()
Constructs a TableRowHeader. Calls the constructor of this class which takes a JTable as a parameter, passing it null.

TableRowHeader(javax.swing.JTable)

  public TableRowHeader(JTable table)
Constructs a TableRowHeader and specifies the table for which the component displays header information. Calls the constructor of this class which takes a JTable and a TableCellRenderer as parameters, passing it the specified table and null.

Parameters:

table
The table for which the TableRowHeader is a row header.

TableRowHeader(javax.swing.JTable, javax.swing.table.TableCellRenderer)

  public TableRowHeader(JTable table, TableCellRenderer renderer)
Constructs a TableRowHeader and specifies the table for which the component displays header information and the renderer used to render the cells of the header.

Parameters:

table
The table for which the TableRowHeader is a row header.
renderer
The cell renderer that renders the cells of the row header.

TableRowHeader properties

cellRenderer

 public TableCellRenderer getCellRenderer()
 public void setCellRenderer(TableCellRenderer renderer)
Returns and sets the cell renderer that renders each row's header cell. If no renderer is specified, TableRowNoRenderer is used by default, which simply renders the current row number.

focusTraversable

 public boolean isFocusTraversable()
Overrides JComponent.IsFocusTraversable() to ensure that the row header never gets focus.

heightResizable

 public boolean isHeightResizable()
 public void setHeightResizable(boolean heightResizable)
Determines whether the header can be resized vertically. If heightResizable is true, the header can be resized; otherwise, it is false.

model

 public TableModel getModel()
 public void setModel(TableModel model)
Returns and sets the model used by the row header. Uses the model of the JTable specified by the table property, unless another model has been explicitly specified. If neither a model nor a table is specified, a DefaultTableModel is used.

requestFocusEnabled

 public boolean isRequestFocusEnabled()
Overrides JComponent.isRequestFocusEnabled() to ensure that the row header never gets focus.

resizeTableWhileSizing

 public boolean isResizeTableWhileSizing()
 public void setResizeTableWhileSizing(boolean resizeTableWhileSizing)
Determines whether the row heights of the table are updated while the top row header cell is resized. Returns true if the row heights of the table are updated while the top row header cell is resized. This property is set to true by default.

table

 public JTable getTable()
 public void setTable(JTable table)
Returns and sets the JTable for which the row header displays information. The table property must be set for TableRowHeader to display information properly.

UIClassID

 public String getUIClassID()
Returns the UIClassID of TableRowHeader.

TableRowHeader methods

repaintRows(int, int)

  public void repaintRows(int firstRow, int lastRow)
A utility method used by renderers to request that one or more row header cells be repainted.

Parameters:

firstRow
The first row of the block of rows to be repainted.
lastRow
The last row of the block of rows to be repainted.

updateUI()

  public void updateUI()
Updates the UI.

Overrides: javax.swing.JComponent.updateUI()


TableRowHeader event listeners

This component is a source for the following event sets.

ancestor

 public void addAncestorListener(javax.swing.event.AncestorListener )
 public void removeAncestorListener(javax.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public synchronized void removeContainerListener(java.awt.event.ContainerListener )

focus

 public synchronized void addFocusListener(java.awt.event.FocusListener )
 public synchronized void removeFocusListener(java.awt.event.FocusListener )

inputMethod

 public synchronized void addInputMethodListener(java.awt.event.InputMethodListener )
 public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )

key

 public synchronized void addKeyListener(java.awt.event.KeyListener )
 public synchronized void removeKeyListener(java.awt.event.KeyListener )

mouse

 public synchronized void addMouseListener(java.awt.event.MouseListener )
 public synchronized void removeMouseListener(java.awt.event.MouseListener )

mouseMotion

 public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener )
 public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )