borland Packages Class Hierarchy dbswing Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----com.borland.dbswing.TableRowHeader
Variables Constructors Properties Methods Event Listeners
Implements ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, TableModelListener
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 |
JTable jTable = new JTable(20, 10); // an empty JTable with 20 rows and 10 columns JScrollPane jScrollPane = new JScrollPane(jTable); jScrollPane.setRowHeaderView(new TableRowHeader());
public static final int MAX_SIZE = 3Column index passed to renderer when asked its maximum size.
public static final int MIN_SIZE = 2Column index passed to renderer when asked its minimum size.
public static final int PAINT = 0Column index passed to renderer when about to paint.
public static final int PREF_SIZE = 1Column index passed to renderer when asked its preferred size.
public TableRowHeader()Constructs a
TableRowHeader
. Calls the constructor of this
class which takes a JTable
as a parameter, passing it null
.
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
.
table
TableRowHeader
is a row header.
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.
table
TableRowHeader
is a row header.
renderer
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.
public boolean isFocusTraversable()Overrides
JComponent.IsFocusTraversable()
to ensure that the row header never gets focus.
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
.
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.
public boolean isRequestFocusEnabled()Overrides
JComponent.isRequestFocusEnabled()
to ensure that the row header never gets focus.
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.
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.
public String getUIClassID()Returns the
UIClassID
of TableRowHeader
.
public void repaintRows(int firstRow, int lastRow)A utility method used by renderers to request that one or more row header cells be repainted.
firstRow
lastRow
public void updateUI()Updates the UI.
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public synchronized void addFocusListener(java.awt.event.FocusListener ) public synchronized void removeFocusListener(java.awt.event.FocusListener )
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public synchronized void addKeyListener(java.awt.event.KeyListener ) public synchronized void removeKeyListener(java.awt.event.KeyListener )
public synchronized void addMouseListener(java.awt.event.MouseListener ) public synchronized void removeMouseListener(java.awt.event.MouseListener )
public synchronized void addMouseMotionListener(java.awt.event.MouseMotionListener ) public synchronized void removeMouseMotionListener(java.awt.event.MouseMotionListener )
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )