public interface IJTable extends IJComponent
| Modifier and Type | Method and Description |
|---|---|
int |
columnAtPoint(Point point)
Returns the index of the column that
point lies in,
or -1 if the result is not in the range
[0, getColumnCount()-1]. |
int |
convertColumnIndexToModel(int i) |
int |
convertColumnIndexToView(int i) |
int |
convertRowIndexToModel(int i) |
int |
convertRowIndexToView(int i) |
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
Returns a rectangle for the cell that lies at the intersection of
row and column. |
TableColumnModel |
getColumnModel()
Returns the
TableColumnModel that contains all column information
of this table. |
Component |
getComponent() |
TableModel |
getModel() |
int |
getSelectedColumn()
Returns the index of the first selected column,
-1 if no column is selected.
|
int |
getSelectedRow()
Returns the index of the first selected row, -1 if no row is selected.
|
int[] |
getSelectedRows()
Returns the indices of all selected rows.
|
ListSelectionModel |
getSelectionModel()
Returns the
ListSelectionModel that is used to maintain row
selection state. |
int |
rowAtPoint(Point point)
Returns the index of the row that
point lies in,
or -1 if the result is not in the range
[0, getRowCount()-1]. |
void |
setDefaultRenderer(Class<?> columnClass,
TableCellRenderer renderer)
Sets a default cell renderer to be used if no renderer has been set in
a
TableColumn. |
void |
setModel(TableModel dataModel) |
void |
setRowSelectionAllowed(boolean rowSelectionAllowed)
Sets whether the rows in this model can be selected.
|
void |
setRowSelectionInterval(int index0,
int index1)
Selects the rows from
index0 to index1,
inclusive. |
void |
setSelectionMode(int selectionMode)
Sets the table's selection mode to allow only single selections, a single
contiguous interval, or multiple intervals.
|
void |
setToolTipText(String text)
Registers the text to display in a tool tip.
|
addPropertyChangeListener, addPropertyChangeListener, getClientProperty, getComponentPopupMenu, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, setBorder, setTransferHandler, updateUIadd, add, addContainerListener, getComponentAt, getLayout, removeContainerListener, setLayoutaddFocusListener, addKeyListener, addMouseListener, getLocationOnScreen, isEnabled, removeFocusListener, removeKeyListener, removeMouseListener, repaint, setEnabledint convertRowIndexToView(int i)
int convertRowIndexToModel(int i)
int convertColumnIndexToView(int i)
int convertColumnIndexToModel(int i)
void setModel(TableModel dataModel)
TableModel getModel()
Component getComponent()
void setSelectionMode(int selectionMode)
Note:
JTable provides all the methods for handling
column and row selection. When setting states,
such as setSelectionMode, it not only
updates the mode for the row selection model but also sets similar
values in the selection model of the columnModel.
If you want to have the row and column selection models operating
in different modes, set them both directly.
Both the row and column selection models for JTable
default to using a DefaultListSelectionModel
so that JTable works the same way as the
JList. See the setSelectionMode method
in JList for details about the modes.
void setRowSelectionAllowed(boolean rowSelectionAllowed)
rowSelectionAllowed - true if this model will allow row selection
bound: true
attribute: visualUpdate true
description: If true, an entire row is selected for each selected cell.ListSelectionModel getSelectionModel()
ListSelectionModel that is used to maintain row
selection state.null
if row selection is not allowedint getSelectedRow()
int getSelectedColumn()
void setDefaultRenderer(Class<?> columnClass, TableCellRenderer renderer)
TableColumn. If renderer is null,
removes the default renderer for this column class.columnClass - set the default cell renderer for this columnClassrenderer - default cell renderer to be used for this
columnClassvoid setRowSelectionInterval(int index0,
int index1)
index0 to index1,
inclusive.index0 - one end of the intervalindex1 - the other end of the intervalIllegalArgumentException - if index0 or
index1 lie outside
[0, getRowCount()-1]Rectangle getCellRect(int row, int column, boolean includeSpacing)
row and column.
If includeSpacing is true then the value returned
has the full height and width of the row and column
specified. If it is false, the returned rectangle is inset by the
intercell spacing to return the true bounds of the rendering or
editing component as it will be set during rendering.
If the column index is valid but the row index is less
than zero the method returns a rectangle with the
y and height values set appropriately
and the x and width values both set
to zero. In general, when either the row or column indices indicate a
cell outside the appropriate range, the method returns a rectangle
depicting the closest edge of the closest cell that is within
the table's range. When both row and column indices are out
of range the returned rectangle covers the closest
point of the closest cell.
In all cases, calculations that use this method to calculate
results along one axis will not fail because of anomalies in
calculations along the other axis. When the cell is not valid
the includeSpacing parameter is ignored.
row - the row index where the desired cell
is locatedcolumn - the column index where the desired cell
is located in the display; this is not
necessarily the same as the column index
in the data model for the table; the
convertColumnIndexToView(int)
method may be used to convert a data
model column index to a display
column indexincludeSpacing - if false, return the true cell bounds -
computed by subtracting the intercell
spacing from the height and widths of
the column and row modelsrow,columnint columnAtPoint(Point point)
point lies in,
or -1 if the result is not in the range
[0, getColumnCount()-1].point - the location of interestpoint lies in,
or -1 if the result is not in the range
[0, getColumnCount()-1]rowAtPoint(java.awt.Point)int rowAtPoint(Point point)
point lies in,
or -1 if the result is not in the range
[0, getRowCount()-1].point - the location of interestpoint lies in,
or -1 if the result is not in the range
[0, getRowCount()-1]columnAtPoint(java.awt.Point)void setToolTipText(String text)
See How to Use Tool Tips in The Java Tutorial for further documentation.
text - the string to display; if the text is null,
the tool tip is turned off for this component
preferred: true
description: The text to display in a tool tip.TableColumnModel getColumnModel()
TableColumnModel that contains all column information
of this table.int[] getSelectedRows()
getSelectedRow()Copyright © 2022 vpc open source initiative. All rights reserved.