|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JTable
Safe:
| Field Summary | |
static int |
AUTO_RESIZE_ALL_COLUMNS
Enabled: During all resize operations, proportionately resize all columns. |
static int |
AUTO_RESIZE_LAST_COLUMN
Enabled: During all resize operations, apply adjustments to the last column only. |
static int |
AUTO_RESIZE_NEXT_COLUMN
Enabled: When a column is adjusted in the UI, adjust the next column the opposite way. |
static int |
AUTO_RESIZE_OFF
Enabled: Do not adjust column widths automatically; use a scrollbar. |
static int |
AUTO_RESIZE_SUBSEQUENT_COLUMNS
Enabled: During UI adjustment, change subsequent columns to preserve the total width; this is the default behavior. |
protected boolean |
autoCreateColumnsFromModel
The table will query the TableModel to build the default
set of columns if this is true. |
protected int |
autoResizeMode
Determines if the table automatically resizes the width of the table's columns to take up the entire width of the table, and how it does the resizing. |
protected javax.swing.table.TableCellEditor |
cellEditor
The object that overwrites the screen real estate occupied by the current cell and allows the user to change its contents. |
protected boolean |
cellSelectionEnabled
Obsolete as of Java 2 platform v1.3. |
protected javax.swing.table.TableColumnModel |
columnModel
The TableColumnModel of the table. |
protected javax.swing.table.TableModel |
dataModel
The TableModel of the table. |
protected Hashtable |
defaultEditorsByColumnClass
A table of objects that display and edit the contents of a cell, indexed by class as declared in getColumnClass
in the TableModel interface. |
protected Hashtable |
defaultRenderersByColumnClass
A table of objects that display the contents of a cell, indexed by class as declared in getColumnClass
in the TableModel interface. |
private boolean |
dragEnabled
|
protected int |
editingColumn
Identifies the column of the cell being edited. |
protected int |
editingRow
Identifies the row of the cell being edited. |
protected Component |
editorComp
If editing, the Component that is handling the editing. |
private java.beans.PropertyChangeListener |
editorRemover
|
protected Color |
gridColor
The color of the grid. |
protected Dimension |
preferredViewportSize
Used by the Scrollable interface to determine the initial visible area. |
protected int |
rowHeight
The height in pixels of each row in the table. |
protected int |
rowMargin
The height in pixels of the margin between the cells in each row. |
private SizeSequence |
rowModel
|
protected boolean |
rowSelectionAllowed
True if row selection is allowed in this table. |
protected Color |
selectionBackground
The background color of selected cells. |
protected Color |
selectionForeground
The foreground color of selected cells. |
protected ListSelectionModel |
selectionModel
The ListSelectionModel of the table, used to keep track of row selections. |
protected boolean |
showHorizontalLines
The table draws horizontal lines between cells if showHorizontalLines is true. |
protected boolean |
showVerticalLines
The table draws vertical lines between cells if showVerticalLines is true. |
private boolean |
surrendersFocusOnKeystroke
|
protected javax.swing.table.JTableHeader |
tableHeader
The TableHeader working with the table. |
private static String |
uiClassID
|
| Fields inherited from class javax.swing.JComponent |
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Constructor Summary | |
JTable()
Enabled: Constructs a default JTable that is initialized with a default
data model, a default column model, and a default selection
model. |
|
JTable(int numRows,
int numColumns)
Enabled: Constructs a JTable with numRows
and numColumns of empty cells using
DefaultTableModel. |
|
JTable(Object[][] rowData,
Object[] columnNames)
Enabled: Constructs a JTable to display the values in the two dimensional array,
rowData, with column names, columnNames. |
|
JTable(javax.swing.table.TableModel dm)
Enabled: Constructs a JTable that is initialized with
dm as the data model, a default column model,
and a default selection model. |
|
JTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm)
Enabled: Constructs a JTable that is initialized with
dm as the data model, cm
as the column model, and a default selection model. |
|
JTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
ListSelectionModel sm)
Enabled: Constructs a JTable that is initialized with
dm as the data model, cm as the
column model, and sm as the selection model. |
|
JTable(Vector rowData,
Vector columnNames)
Enabled: Constructs a JTable to display the values in the
Vector of Vectors, rowData,
with column names, columnNames. |
|
| Method Summary | |
private void |
accommodateDelta(int resizingColumnIndex,
int delta)
|
void |
addColumn(javax.swing.table.TableColumn aColumn)
Enabled: Appends aColumn to the end of the array of columns held by
this JTable's column model. |
void |
addColumnSelectionInterval(int index0,
int index1)
Enabled: Adds the columns from index0 to index1,
inclusive, to the current selection. |
void |
addNotify()
Suppressed: Calls the configureEnclosingScrollPane method. |
void |
addRowSelectionInterval(int index0,
int index1)
Enabled: Adds the rows from index0 to index1, inclusive, to
the current selection. |
private void |
adjustSizes(long target,
javax.swing.JTable.Resizable2 r,
boolean limitToRange)
|
private void |
adjustSizes(long target,
javax.swing.JTable.Resizable3 r,
boolean inverse)
|
private int |
boundColumn(int col)
|
private int |
boundRow(int row)
|
void |
changeSelection(int rowIndex,
int columnIndex,
boolean toggle,
boolean extend)
Enabled: Updates the selection models of the table, depending on the state of the two flags: toggle and extend. |
private void |
changeSelectionModel(ListSelectionModel sm,
int index,
boolean toggle,
boolean extend,
boolean selected)
|
void |
clearSelection()
Enabled: Deselects all selected columns and rows. |
void |
columnAdded(TableColumnModelEvent e)
Suppressed: Invoked when a column is added to the table column model. |
int |
columnAtPoint(Point point)
Enabled: Returns the index of the column that point lies in,
or -1 if the result is not in the range
[0, getColumnCount()-1]. |
void |
columnMarginChanged(ChangeEvent e)
Suppressed: Invoked when a column is moved due to a margin change. |
void |
columnMoved(TableColumnModelEvent e)
Suppressed: Invoked when a column is repositioned. |
void |
columnRemoved(TableColumnModelEvent e)
Suppressed: Invoked when a column is removed from the table column model. |
void |
columnSelectionChanged(ListSelectionEvent e)
Suppressed: Invoked when the selection model of the TableColumnModel
is changed. |
(package private) void |
compWriteObjectNotify()
|
protected void |
configureEnclosingScrollPane()
If this JTable is the viewportView of an enclosing JScrollPane
(the usual situation), configure this ScrollPane by, amongst other things,
installing the table's tableHeader as the columnHeaderView of the scroll pane. |
int |
convertColumnIndexToModel(int viewColumnIndex)
Enabled: Maps the index of the column in the view at viewColumnIndex to the index of the column
in the table model. |
int |
convertColumnIndexToView(int modelColumnIndex)
Enabled: Maps the index of the column in the table model at modelColumnIndex to the index of the column
in the view. |
protected javax.swing.table.TableColumnModel |
createDefaultColumnModel()
Returns the default column model object, which is a DefaultTableColumnModel. |
void |
createDefaultColumnsFromModel()
Enabled: Creates default columns for the table from the data model using the getColumnCount method
defined in the TableModel interface. |
protected javax.swing.table.TableModel |
createDefaultDataModel()
Returns the default table model object, which is a DefaultTableModel. |
protected void |
createDefaultEditors()
Creates default cell editors for objects, numbers, and boolean values. |
protected void |
createDefaultRenderers()
Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons. |
protected ListSelectionModel |
createDefaultSelectionModel()
Returns the default selection model object, which is a DefaultListSelectionModel. |
protected javax.swing.table.JTableHeader |
createDefaultTableHeader()
Returns the default table header object, which is a JTableHeader. |
static JScrollPane |
createScrollPaneForTable(JTable aTable)
Deprecated. As of Swing version 1.0.2, replaced by new JScrollPane(aTable). |
void |
doLayout()
Enabled: Causes this table to lay out its rows and columns. |
boolean |
editCellAt(int row,
int column)
Enabled: Programmatically starts editing the cell at row and
column, if the cell is editable. |
boolean |
editCellAt(int row,
int column,
EventObject e)
Enabled: Programmatically starts editing the cell at row and
column, if the cell is editable. |
void |
editingCanceled(ChangeEvent e)
Suppressed: Invoked when editing is canceled. |
void |
editingStopped(ChangeEvent e)
Suppressed: Invoked when editing is finished. |
AccessibleContext |
getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JTable. |
boolean |
getAutoCreateColumnsFromModel()
Enabled: Determines whether the table will create default columns from the model. |
int |
getAutoResizeMode()
Enabled: Returns the auto resize mode of the table. |
javax.swing.table.TableCellEditor |
getCellEditor()
Enabled: Returns the cell editor. |
javax.swing.table.TableCellEditor |
getCellEditor(int row,
int column)
Enabled: Returns an appropriate editor for the cell specified by row and column. |
Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
Enabled: Returns a rectangle for the cell that lies at the intersection of row and column. |
javax.swing.table.TableCellRenderer |
getCellRenderer(int row,
int column)
Enabled: Returns an appropriate renderer for the cell specified by this row and column. |
boolean |
getCellSelectionEnabled()
Enabled: Returns true if both row and column selection models are enabled. |
javax.swing.table.TableColumn |
getColumn(Object identifier)
Enabled: Returns the TableColumn object for the column in the table
whose identifier is equal to identifier, when compared using
equals. |
Class |
getColumnClass(int column)
Enabled: Returns the type of the column appearing in the view at column position column. |
int |
getColumnCount()
Enabled: Returns the number of columns in the column model. |
javax.swing.table.TableColumnModel |
getColumnModel()
Enabled: Returns the TableColumnModel that contains all column information
of this table. |
String |
getColumnName(int column)
Enabled: Returns the name of the column appearing in the view at column position column. |
boolean |
getColumnSelectionAllowed()
Enabled: Returns true if columns can be selected. |
javax.swing.table.TableCellEditor |
getDefaultEditor(Class columnClass)
Enabled: Returns the editor to be used when no editor has been set in a TableColumn. |
javax.swing.table.TableCellRenderer |
getDefaultRenderer(Class columnClass)
Enabled: Returns the cell renderer to be used when no renderer has been set in a TableColumn. |
boolean |
getDragEnabled()
Enabled: Gets the value of the dragEnabled property. |
int |
getEditingColumn()
Enabled: Returns the index of the column that contains the cell currently being edited. |
int |
getEditingRow()
Enabled: Returns the index of the row that contains the cell currently being edited. |
Component |
getEditorComponent()
Enabled: Returns the component that is handling the editing session. |
Color |
getGridColor()
Enabled: Returns the color used to draw grid lines. |
Dimension |
getIntercellSpacing()
Enabled: Returns the horizontal and vertical space between cells. |
javax.swing.table.TableModel |
getModel()
Enabled: Returns the TableModel that provides the data displayed by this
JTable. |
Dimension |
getPreferredScrollableViewportSize()
Enabled: Returns the preferred size of the viewport for this table. |
private javax.swing.table.TableColumn |
getResizingColumn()
|
int |
getRowCount()
Enabled: Returns the number of rows in this table's model. |
int |
getRowHeight()
Enabled: Returns the height of a table row, in pixels. |
int |
getRowHeight(int row)
Enabled: Returns the height, in pixels, of the cells in row. |
int |
getRowMargin()
Enabled: Gets the amount of empty space, in pixels, between cells. |
private SizeSequence |
getRowModel()
|
boolean |
getRowSelectionAllowed()
Enabled: Returns true if rows can be selected. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
Enabled: Returns visibleRect.height or
visibleRect.width,
depending on this table's orientation. |
boolean |
getScrollableTracksViewportHeight()
Enabled: Returns false to indicate that the height of the viewport does not determine the height of the table. |
boolean |
getScrollableTracksViewportWidth()
Enabled: Returns false if autoResizeMode is set to
AUTO_RESIZE_OFF, which indicates that the
width of the viewport does not determine the width
of the table. |
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Enabled: Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation). |
int |
getSelectedColumn()
Enabled: Returns the index of the first selected column, -1 if no column is selected. |
int |
getSelectedColumnCount()
Enabled: Returns the number of selected columns. |
int[] |
getSelectedColumns()
Enabled: Returns the indices of all selected columns. |
int |
getSelectedRow()
Enabled: Returns the index of the first selected row, -1 if no row is selected. |
int |
getSelectedRowCount()
Enabled: Returns the number of selected rows. |
int[] |
getSelectedRows()
Enabled: Returns the indices of all selected rows. |
Color |
getSelectionBackground()
Enabled: Returns the background color for selected cells. |
Color |
getSelectionForeground()
Enabled: Returns the foreground color for selected cells. |
ListSelectionModel |
getSelectionModel()
Enabled: Returns the ListSelectionModel that is used to maintain row
selection state. |
boolean |
getShowHorizontalLines()
Enabled: Returns true if the table draws horizontal lines between cells, false if it doesn't. |
boolean |
getShowVerticalLines()
Enabled: Returns true if the table draws vertical lines between cells, false if it doesn't. |
boolean |
getSurrendersFocusOnKeystroke()
Enabled: Returns true if the editor should get the focus when keystrokes cause the editor to be activated |
javax.swing.table.JTableHeader |
getTableHeader()
Enabled: Returns the tableHeader used by this JTable. |
String |
getToolTipText(MouseEvent event)
Enabled: Overrides JComponent's getToolTipText
method in order to allow the renderer's tips to be used
if it has text set. |
javax.swing.plaf.TableUI |
getUI()
Suppressed: Returns the L&F object that renders this component. |
String |
getUIClassID()
Suppressed: Returns the suffix used to construct the name of the L&F class used to render this component. |
Object |
getValueAt(int row,
int column)
Enabled: Returns the cell value at row and column. |
protected void |
initializeLocalVars()
Initializes table properties to their default values. |
boolean |
isCellEditable(int row,
int column)
Enabled: Returns true if the cell at row and column
is editable. |
boolean |
isCellSelected(int row,
int column)
Enabled: Returns true if the cell at the specified position is selected. |
boolean |
isColumnSelected(int column)
Enabled: Returns true if the column at the specified index is selected. |
boolean |
isEditing()
Enabled: Returns true if a cell is being edited. |
boolean |
isRowSelected(int row)
Enabled: Returns true if the row at the specified index is selected. |
private int |
limit(int i,
int a,
int b)
|
void |
moveColumn(int column,
int targetColumn)
Enabled: Moves the column column to the position currently
occupied by the column targetColumn in the view. |
protected String |
paramString()
Returns a string representation of this table. |
Component |
prepareEditor(javax.swing.table.TableCellEditor editor,
int row,
int column)
Enabled: Prepares the editor by querying the data model for the value and selection state of the cell at row, column. |
Component |
prepareRenderer(javax.swing.table.TableCellRenderer renderer,
int row,
int column)
Enabled: Prepares the renderer by querying the data model for the value and selection state of the cell at row, column. |
protected boolean |
processKeyBinding(KeyStroke ks,
KeyEvent e,
int condition,
boolean pressed)
Invoked to process the key bindings for ks as the result
of the KeyEvent e. |
private void |
readObject(ObjectInputStream s)
We use the ObjectInputStream "registerValidation"
callback to update the UI for the entire tree of components
after they've all been read in. |
void |
removeColumn(javax.swing.table.TableColumn aColumn)
Enabled: Removes aColumn from this JTable's
array of columns. |
void |
removeColumnSelectionInterval(int index0,
int index1)
Enabled: Deselects the columns from index0 to index1, inclusive. |
void |
removeEditor()
Enabled: Discards the editor object and frees the real estate it used for cell rendering. |
void |
removeNotify()
Suppressed: Calls the unconfigureEnclosingScrollPane method. |
void |
removeRowSelectionInterval(int index0,
int index1)
Enabled: Deselects the rows from index0 to index1, inclusive. |
protected void |
resizeAndRepaint()
Equivalent to revalidate followed by repaint. |
int |
rowAtPoint(Point point)
Enabled: Returns the index of the row that point lies in,
or -1 if the result is not in the range
[0, getRowCount()-1]. |
void |
selectAll()
Enabled: Selects all rows, columns, and cells in the table. |
void |
setAutoCreateColumnsFromModel(boolean autoCreateColumnsFromModel)
Enabled: Sets this table's autoCreateColumnsFromModel flag. |
void |
setAutoResizeMode(int mode)
Enabled: Sets the table's auto resize mode when the table is resized. |
void |
setCellEditor(javax.swing.table.TableCellEditor anEditor)
Enabled: Sets the cellEditor variable. |
void |
setCellSelectionEnabled(boolean cellSelectionEnabled)
Enabled: Sets whether this table allows both a column selection and a row selection to exist simultaneously. |
void |
setColumnModel(javax.swing.table.TableColumnModel columnModel)
Enabled: Sets the column model for this table to newModel and registers
for listener notifications from the new column model. |
void |
setColumnSelectionAllowed(boolean columnSelectionAllowed)
Enabled: Sets whether the columns in this model can be selected. |
void |
setColumnSelectionInterval(int index0,
int index1)
Enabled: Selects the columns from index0 to index1,
inclusive. |
void |
setDefaultEditor(Class columnClass,
javax.swing.table.TableCellEditor editor)
Enabled: Sets a default cell editor to be used if no editor has been set in a TableColumn. |
void |
setDefaultRenderer(Class columnClass,
javax.swing.table.TableCellRenderer renderer)
Enabled: Sets a default cell renderer to be used if no renderer has been set in a TableColumn. |
void |
setDragEnabled(boolean b)
Enabled: Sets the dragEnabled property,
which must be true to enable
automatic drag handling (the first part of drag and drop)
on this component. |
void |
setEditingColumn(int aColumn)
Enabled: Sets the editingColumn variable. |
void |
setEditingRow(int aRow)
Enabled: Sets the editingRow variable. |
void |
setGridColor(Color gridColor)
Enabled: Sets the color used to draw grid lines to gridColor and redisplays. |
void |
setIntercellSpacing(Dimension intercellSpacing)
Enabled: Sets the rowMargin and the columnMargin --
the height and width of the space between cells -- to
intercellSpacing. |
private void |
setLazyEditor(Class c,
String s)
|
private void |
setLazyRenderer(Class c,
String s)
|
private void |
setLazyValue(Hashtable h,
Class c,
String s)
|
void |
setModel(javax.swing.table.TableModel dataModel)
Enabled: Sets the data model for this table to newModel and registers
with it for listener notifications from the new data model. |
void |
setPreferredScrollableViewportSize(Dimension size)
Enabled: Sets the preferred size of the viewport for this table. |
void |
setRowHeight(int rowHeight)
Enabled: Sets the height, in pixels, of all cells to rowHeight,
revalidates, and repaints. |
void |
setRowHeight(int row,
int rowHeight)
Enabled: Sets the height for row to rowHeight,
revalidates, and repaints. |
void |
setRowMargin(int rowMargin)
Enabled: Sets the amount of empty space between cells in adjacent rows. |
void |
setRowSelectionAllowed(boolean rowSelectionAllowed)
Enabled: Sets whether the rows in this model can be selected. |
void |
setRowSelectionInterval(int index0,
int index1)
Enabled: Selects the rows from index0 to index1,
inclusive. |
void |
setSelectionBackground(Color selectionBackground)
Enabled: Sets the background color for selected cells. |
void |
setSelectionForeground(Color selectionForeground)
Enabled: Sets the foreground color for selected cells. |
void |
setSelectionMode(int selectionMode)
Enabled: Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals. |
void |
setSelectionModel(ListSelectionModel newModel)
Enabled: Sets the row selection model for this table to newModel
and registers for listener notifications from the new selection model. |
void |
setShowGrid(boolean showGrid)
Enabled: Sets whether the table draws grid lines around cells. |
void |
setShowHorizontalLines(boolean showHorizontalLines)
Enabled: Sets whether the table draws horizontal lines between cells. |
void |
setShowVerticalLines(boolean showVerticalLines)
Enabled: Sets whether the table draws vertical lines between cells. |
void |
setSurrendersFocusOnKeystroke(boolean surrendersFocusOnKeystroke)
Suppressed: Sets whether editors in this JTable get the keyboard focus when an editor is activated as a result of the JTable forwarding keyboard events for a cell. |
void |
setTableHeader(javax.swing.table.JTableHeader tableHeader)
Enabled: Sets the tableHeader working with this JTable to newHeader. |
void |
setUI(javax.swing.plaf.TableUI ui)
Suppressed: Sets the L&F object that renders this component and repaints. |
void |
setValueAt(Object aValue,
int row,
int column)
Enabled: Sets the value for the cell in the table model at row
and column. |
private void |
setWidthsFromPreferredWidths(boolean inverse)
|
void |
sizeColumnsToFit(boolean lastColumnOnly)
Deprecated. As of Swing version 1.0.3, replaced by doLayout(). |
void |
sizeColumnsToFit(int resizingColumn)
Enabled: Obsolete as of Java 2 platform v1.4. |
void |
tableChanged(TableModelEvent e)
Suppressed: Invoked when this table's TableModel generates
a TableModelEvent. |
private void |
tableRowsDeleted(TableModelEvent e)
|
private void |
tableRowsInserted(TableModelEvent e)
|
protected void |
unconfigureEnclosingScrollPane()
Reverses the effect of configureEnclosingScrollPane
by replacing the columnHeaderView of the enclosing
scroll pane with null. |
private void |
updateSubComponentUI(Object componentShell)
|
void |
updateUI()
Suppressed: Notification from the UIManager that the L&F has changed. |
void |
valueChanged(ListSelectionEvent e)
Suppressed: Invoked when the row selection changes -- repaints to show the new selection. |
private int |
viewIndexForColumn(javax.swing.table.TableColumn aColumn)
|
private void |
writeObject(ObjectOutputStream s)
See readObject() and writeObject() in JComponent for more information about serialization in Swing. |
| 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, |