JTable (Java Platform SE 8 ) (original) (raw)
Modifier and Type
Method
Description
void
[addColumn](../../javax/swing/JTable.html#addColumn-javax.swing.table.TableColumn-)([TableColumn](../../javax/swing/table/TableColumn.html "class in javax.swing.table") aColumn)
Appends aColumn
to the end of the array of columns held by this JTable
's column model.
void
[addColumnSelectionInterval](../../javax/swing/JTable.html#addColumnSelectionInterval-int-int-)(int index0, int index1)
Adds the columns from index0
to index1
, inclusive, to the current selection.
void
[addNotify](../../javax/swing/JTable.html#addNotify--)()
Calls the configureEnclosingScrollPane
method.
void
[addRowSelectionInterval](../../javax/swing/JTable.html#addRowSelectionInterval-int-int-)(int index0, int index1)
Adds the rows from index0
to index1
, inclusive, to the current selection.
void
[changeSelection](../../javax/swing/JTable.html#changeSelection-int-int-boolean-boolean-)(int rowIndex, int columnIndex, boolean toggle, boolean extend)
Updates the selection models of the table, depending on the state of the two flags: toggle
and extend
.
void
[clearSelection](../../javax/swing/JTable.html#clearSelection--)()
Deselects all selected columns and rows.
void
[columnAdded](../../javax/swing/JTable.html#columnAdded-javax.swing.event.TableColumnModelEvent-)([TableColumnModelEvent](../../javax/swing/event/TableColumnModelEvent.html "class in javax.swing.event") e)
Invoked when a column is added to the table column model.
int
[columnAtPoint](../../javax/swing/JTable.html#columnAtPoint-java.awt.Point-)([Point](../../java/awt/Point.html "class in java.awt") point)
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](../../javax/swing/JTable.html#columnMarginChanged-javax.swing.event.ChangeEvent-)([ChangeEvent](../../javax/swing/event/ChangeEvent.html "class in javax.swing.event") e)
Invoked when a column is moved due to a margin change.
void
[columnMoved](../../javax/swing/JTable.html#columnMoved-javax.swing.event.TableColumnModelEvent-)([TableColumnModelEvent](../../javax/swing/event/TableColumnModelEvent.html "class in javax.swing.event") e)
Invoked when a column is repositioned.
void
[columnRemoved](../../javax/swing/JTable.html#columnRemoved-javax.swing.event.TableColumnModelEvent-)([TableColumnModelEvent](../../javax/swing/event/TableColumnModelEvent.html "class in javax.swing.event") e)
Invoked when a column is removed from the table column model.
void
[columnSelectionChanged](../../javax/swing/JTable.html#columnSelectionChanged-javax.swing.event.ListSelectionEvent-)([ListSelectionEvent](../../javax/swing/event/ListSelectionEvent.html "class in javax.swing.event") e)
Invoked when the selection model of the TableColumnModel
is changed.
protected void
[configureEnclosingScrollPane](../../javax/swing/JTable.html#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](../../javax/swing/JTable.html#convertColumnIndexToModel-int-)(int viewColumnIndex)
Maps the index of the column in the view atviewColumnIndex
to the index of the column in the table model.
int
[convertColumnIndexToView](../../javax/swing/JTable.html#convertColumnIndexToView-int-)(int modelColumnIndex)
Maps the index of the column in the table model atmodelColumnIndex
to the index of the column in the view.
int
[convertRowIndexToModel](../../javax/swing/JTable.html#convertRowIndexToModel-int-)(int viewRowIndex)
Maps the index of the row in terms of the view to the underlying TableModel
.
int
[convertRowIndexToView](../../javax/swing/JTable.html#convertRowIndexToView-int-)(int modelRowIndex)
Maps the index of the row in terms of theTableModel
to the view.
protected [TableColumnModel](../../javax/swing/table/TableColumnModel.html "interface in javax.swing.table")
[createDefaultColumnModel](../../javax/swing/JTable.html#createDefaultColumnModel--)()
Returns the default column model object, which is a DefaultTableColumnModel
.
void
[createDefaultColumnsFromModel](../../javax/swing/JTable.html#createDefaultColumnsFromModel--)()
Creates default columns for the table from the data model using the getColumnCount
method defined in the TableModel
interface.
protected [TableModel](../../javax/swing/table/TableModel.html "interface in javax.swing.table")
[createDefaultDataModel](../../javax/swing/JTable.html#createDefaultDataModel--)()
Returns the default table model object, which is a DefaultTableModel
.
protected void
[createDefaultEditors](../../javax/swing/JTable.html#createDefaultEditors--)()
Creates default cell editors for objects, numbers, and boolean values.
protected void
[createDefaultRenderers](../../javax/swing/JTable.html#createDefaultRenderers--)()
Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons.
protected [ListSelectionModel](../../javax/swing/ListSelectionModel.html "interface in javax.swing")
[createDefaultSelectionModel](../../javax/swing/JTable.html#createDefaultSelectionModel--)()
Returns the default selection model object, which is a DefaultListSelectionModel
.
protected [JTableHeader](../../javax/swing/table/JTableHeader.html "class in javax.swing.table")
[createDefaultTableHeader](../../javax/swing/JTable.html#createDefaultTableHeader--)()
Returns the default table header object, which is a JTableHeader
.
static [JScrollPane](../../javax/swing/JScrollPane.html "class in javax.swing")
[createScrollPaneForTable](../../javax/swing/JTable.html#createScrollPaneForTable-javax.swing.JTable-)([JTable](../../javax/swing/JTable.html "class in javax.swing") aTable)
void
[doLayout](../../javax/swing/JTable.html#doLayout--)()
Causes this table to lay out its rows and columns.
boolean
[editCellAt](../../javax/swing/JTable.html#editCellAt-int-int-)(int row, int column)
Programmatically starts editing the cell at row
andcolumn
, if those indices are in the valid range, and the cell at those indices is editable.
boolean
[editCellAt](../../javax/swing/JTable.html#editCellAt-int-int-java.util.EventObject-)(int row, int column,[EventObject](../../java/util/EventObject.html "class in java.util") e)
Programmatically starts editing the cell at row
andcolumn
, if those indices are in the valid range, and the cell at those indices is editable.
void
[editingCanceled](../../javax/swing/JTable.html#editingCanceled-javax.swing.event.ChangeEvent-)([ChangeEvent](../../javax/swing/event/ChangeEvent.html "class in javax.swing.event") e)
Invoked when editing is canceled.
void
[editingStopped](../../javax/swing/JTable.html#editingStopped-javax.swing.event.ChangeEvent-)([ChangeEvent](../../javax/swing/event/ChangeEvent.html "class in javax.swing.event") e)
Invoked when editing is finished.
[AccessibleContext](../../javax/accessibility/AccessibleContext.html "class in javax.accessibility")
[getAccessibleContext](../../javax/swing/JTable.html#getAccessibleContext--)()
Gets the AccessibleContext associated with this JTable.
boolean
[getAutoCreateColumnsFromModel](../../javax/swing/JTable.html#getAutoCreateColumnsFromModel--)()
Determines whether the table will create default columns from the model.
boolean
[getAutoCreateRowSorter](../../javax/swing/JTable.html#getAutoCreateRowSorter--)()
Returns true
if whenever the model changes, a newRowSorter
should be created and installed as the table's sorter; otherwise, returns false
.
int
[getAutoResizeMode](../../javax/swing/JTable.html#getAutoResizeMode--)()
Returns the auto resize mode of the table.
[TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table")
[getCellEditor](../../javax/swing/JTable.html#getCellEditor--)()
Returns the active cell editor, which is null
if the table is not currently editing.
[TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table")
[getCellEditor](../../javax/swing/JTable.html#getCellEditor-int-int-)(int row, int column)
Returns an appropriate editor for the cell specified byrow
and column
.
[Rectangle](../../java/awt/Rectangle.html "class in java.awt")
[getCellRect](../../javax/swing/JTable.html#getCellRect-int-int-boolean-)(int row, int column, boolean includeSpacing)
Returns a rectangle for the cell that lies at the intersection ofrow
and column
.
[TableCellRenderer](../../javax/swing/table/TableCellRenderer.html "interface in javax.swing.table")
[getCellRenderer](../../javax/swing/JTable.html#getCellRenderer-int-int-)(int row, int column)
Returns an appropriate renderer for the cell specified by this row and column.
boolean
[getCellSelectionEnabled](../../javax/swing/JTable.html#getCellSelectionEnabled--)()
Returns true if both row and column selection models are enabled.
[TableColumn](../../javax/swing/table/TableColumn.html "class in javax.swing.table")
[getColumn](../../javax/swing/JTable.html#getColumn-java.lang.Object-)([Object](../../java/lang/Object.html "class in java.lang") identifier)
Returns the TableColumn
object for the column in the table whose identifier is equal to identifier
, when compared usingequals
.
[Class](../../java/lang/Class.html "class in java.lang")<?>
[getColumnClass](../../javax/swing/JTable.html#getColumnClass-int-)(int column)
Returns the type of the column appearing in the view at column position column
.
int
[getColumnCount](../../javax/swing/JTable.html#getColumnCount--)()
Returns the number of columns in the column model.
[TableColumnModel](../../javax/swing/table/TableColumnModel.html "interface in javax.swing.table")
[getColumnModel](../../javax/swing/JTable.html#getColumnModel--)()
Returns the TableColumnModel
that contains all column information of this table.
[String](../../java/lang/String.html "class in java.lang")
[getColumnName](../../javax/swing/JTable.html#getColumnName-int-)(int column)
Returns the name of the column appearing in the view at column position column
.
boolean
[getColumnSelectionAllowed](../../javax/swing/JTable.html#getColumnSelectionAllowed--)()
Returns true if columns can be selected.
[TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table")
[getDefaultEditor](../../javax/swing/JTable.html#getDefaultEditor-java.lang.Class-)([Class](../../java/lang/Class.html "class in java.lang")<?> columnClass)
Returns the editor to be used when no editor has been set in a TableColumn
.
[TableCellRenderer](../../javax/swing/table/TableCellRenderer.html "interface in javax.swing.table")
[getDefaultRenderer](../../javax/swing/JTable.html#getDefaultRenderer-java.lang.Class-)([Class](../../java/lang/Class.html "class in java.lang")<?> columnClass)
Returns the cell renderer to be used when no renderer has been set in a TableColumn
.
boolean
[getDragEnabled](../../javax/swing/JTable.html#getDragEnabled--)()
Returns whether or not automatic drag handling is enabled.
[JTable.DropLocation](../../javax/swing/JTable.DropLocation.html "class in javax.swing")
[getDropLocation](../../javax/swing/JTable.html#getDropLocation--)()
Returns the location that this component should visually indicate as the drop location during a DnD operation over the component, or null
if no location is to currently be shown.
[DropMode](../../javax/swing/DropMode.html "enum in javax.swing")
[getDropMode](../../javax/swing/JTable.html#getDropMode--)()
Returns the drop mode for this component.
int
[getEditingColumn](../../javax/swing/JTable.html#getEditingColumn--)()
Returns the index of the column that contains the cell currently being edited.
int
[getEditingRow](../../javax/swing/JTable.html#getEditingRow--)()
Returns the index of the row that contains the cell currently being edited.
[Component](../../java/awt/Component.html "class in java.awt")
[getEditorComponent](../../javax/swing/JTable.html#getEditorComponent--)()
Returns the component that is handling the editing session.
boolean
[getFillsViewportHeight](../../javax/swing/JTable.html#getFillsViewportHeight--)()
Returns whether or not this table is always made large enough to fill the height of an enclosing viewport.
[Color](../../java/awt/Color.html "class in java.awt")
[getGridColor](../../javax/swing/JTable.html#getGridColor--)()
Returns the color used to draw grid lines.
[Dimension](../../java/awt/Dimension.html "class in java.awt")
[getIntercellSpacing](../../javax/swing/JTable.html#getIntercellSpacing--)()
Returns the horizontal and vertical space between cells.
[TableModel](../../javax/swing/table/TableModel.html "interface in javax.swing.table")
[getModel](../../javax/swing/JTable.html#getModel--)()
Returns the TableModel
that provides the data displayed by thisJTable
.
[Dimension](../../java/awt/Dimension.html "class in java.awt")
[getPreferredScrollableViewportSize](../../javax/swing/JTable.html#getPreferredScrollableViewportSize--)()
Returns the preferred size of the viewport for this table.
[Printable](../../java/awt/print/Printable.html "interface in java.awt.print")
[getPrintable](../../javax/swing/JTable.html#getPrintable-javax.swing.JTable.PrintMode-java.text.MessageFormat-java.text.MessageFormat-)([JTable.PrintMode](../../javax/swing/JTable.PrintMode.html "enum in javax.swing") printMode,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") headerFormat,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") footerFormat)
Return a Printable
for use in printing this JTable.
int
[getRowCount](../../javax/swing/JTable.html#getRowCount--)()
Returns the number of rows that can be shown in theJTable
, given unlimited space.
int
[getRowHeight](../../javax/swing/JTable.html#getRowHeight--)()
Returns the height of a table row, in pixels.
int
[getRowHeight](../../javax/swing/JTable.html#getRowHeight-int-)(int row)
Returns the height, in pixels, of the cells in row
.
int
[getRowMargin](../../javax/swing/JTable.html#getRowMargin--)()
Gets the amount of empty space, in pixels, between cells.
boolean
[getRowSelectionAllowed](../../javax/swing/JTable.html#getRowSelectionAllowed--)()
Returns true if rows can be selected.
[RowSorter](../../javax/swing/RowSorter.html "class in javax.swing")<? extends [TableModel](../../javax/swing/table/TableModel.html "interface in javax.swing.table")>
[getRowSorter](../../javax/swing/JTable.html#getRowSorter--)()
Returns the object responsible for sorting.
int
[getScrollableBlockIncrement](../../javax/swing/JTable.html#getScrollableBlockIncrement-java.awt.Rectangle-int-int-)([Rectangle](../../java/awt/Rectangle.html "class in java.awt") visibleRect, int orientation, int direction)
Returns visibleRect.height
orvisibleRect.width
, depending on this table's orientation.
boolean
[getScrollableTracksViewportHeight](../../javax/swing/JTable.html#getScrollableTracksViewportHeight--)()
Returns false
to indicate that the height of the viewport does not determine the height of the table, unlessgetFillsViewportHeight
is true
and the preferred height of the table is smaller than the viewport's height.
boolean
[getScrollableTracksViewportWidth](../../javax/swing/JTable.html#getScrollableTracksViewportWidth--)()
Returns false if autoResizeMode
is set toAUTO_RESIZE_OFF
, which indicates that the width of the viewport does not determine the width of the table.
int
[getScrollableUnitIncrement](../../javax/swing/JTable.html#getScrollableUnitIncrement-java.awt.Rectangle-int-int-)([Rectangle](../../java/awt/Rectangle.html "class in java.awt") visibleRect, int orientation, int direction)
Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation).
int
[getSelectedColumn](../../javax/swing/JTable.html#getSelectedColumn--)()
Returns the index of the first selected column, -1 if no column is selected.
int
[getSelectedColumnCount](../../javax/swing/JTable.html#getSelectedColumnCount--)()
Returns the number of selected columns.
int[]
[getSelectedColumns](../../javax/swing/JTable.html#getSelectedColumns--)()
Returns the indices of all selected columns.
int
[getSelectedRow](../../javax/swing/JTable.html#getSelectedRow--)()
Returns the index of the first selected row, -1 if no row is selected.
int
[getSelectedRowCount](../../javax/swing/JTable.html#getSelectedRowCount--)()
Returns the number of selected rows.
int[]
[getSelectedRows](../../javax/swing/JTable.html#getSelectedRows--)()
Returns the indices of all selected rows.
[Color](../../java/awt/Color.html "class in java.awt")
[getSelectionBackground](../../javax/swing/JTable.html#getSelectionBackground--)()
Returns the background color for selected cells.
[Color](../../java/awt/Color.html "class in java.awt")
[getSelectionForeground](../../javax/swing/JTable.html#getSelectionForeground--)()
Returns the foreground color for selected cells.
[ListSelectionModel](../../javax/swing/ListSelectionModel.html "interface in javax.swing")
[getSelectionModel](../../javax/swing/JTable.html#getSelectionModel--)()
Returns the ListSelectionModel
that is used to maintain row selection state.
boolean
[getShowHorizontalLines](../../javax/swing/JTable.html#getShowHorizontalLines--)()
Returns true if the table draws horizontal lines between cells, false if it doesn't.
boolean
[getShowVerticalLines](../../javax/swing/JTable.html#getShowVerticalLines--)()
Returns true if the table draws vertical lines between cells, false if it doesn't.
boolean
[getSurrendersFocusOnKeystroke](../../javax/swing/JTable.html#getSurrendersFocusOnKeystroke--)()
Returns true if the editor should get the focus when keystrokes cause the editor to be activated
[JTableHeader](../../javax/swing/table/JTableHeader.html "class in javax.swing.table")
[getTableHeader](../../javax/swing/JTable.html#getTableHeader--)()
Returns the tableHeader
used by this JTable
.
[String](../../java/lang/String.html "class in java.lang")
[getToolTipText](../../javax/swing/JTable.html#getToolTipText-java.awt.event.MouseEvent-)([MouseEvent](../../java/awt/event/MouseEvent.html "class in java.awt.event") event)
Overrides JComponent
's getToolTipText
method in order to allow the renderer's tips to be used if it has text set.
[TableUI](../../javax/swing/plaf/TableUI.html "class in javax.swing.plaf")
[getUI](../../javax/swing/JTable.html#getUI--)()
Returns the L&F object that renders this component.
[String](../../java/lang/String.html "class in java.lang")
[getUIClassID](../../javax/swing/JTable.html#getUIClassID--)()
Returns the suffix used to construct the name of the L&F class used to render this component.
boolean
[getUpdateSelectionOnSort](../../javax/swing/JTable.html#getUpdateSelectionOnSort--)()
Returns true if the selection should be updated after sorting.
[Object](../../java/lang/Object.html "class in java.lang")
[getValueAt](../../javax/swing/JTable.html#getValueAt-int-int-)(int row, int column)
Returns the cell value at row
and column
.
protected void
[initializeLocalVars](../../javax/swing/JTable.html#initializeLocalVars--)()
Initializes table properties to their default values.
boolean
[isCellEditable](../../javax/swing/JTable.html#isCellEditable-int-int-)(int row, int column)
Returns true if the cell at row
and column
is editable.
boolean
[isCellSelected](../../javax/swing/JTable.html#isCellSelected-int-int-)(int row, int column)
Returns true if the specified indices are in the valid range of rows and columns and the cell at the specified position is selected.
boolean
[isColumnSelected](../../javax/swing/JTable.html#isColumnSelected-int-)(int column)
Returns true if the specified index is in the valid range of columns, and the column at that index is selected.
boolean
[isEditing](../../javax/swing/JTable.html#isEditing--)()
Returns true if a cell is being edited.
boolean
[isRowSelected](../../javax/swing/JTable.html#isRowSelected-int-)(int row)
Returns true if the specified index is in the valid range of rows, and the row at that index is selected.
void
[moveColumn](../../javax/swing/JTable.html#moveColumn-int-int-)(int column, int targetColumn)
Moves the column column
to the position currently occupied by the column targetColumn
in the view.
protected [String](../../java/lang/String.html "class in java.lang")
[paramString](../../javax/swing/JTable.html#paramString--)()
Returns a string representation of this table.
[Component](../../java/awt/Component.html "class in java.awt")
[prepareEditor](../../javax/swing/JTable.html#prepareEditor-javax.swing.table.TableCellEditor-int-int-)([TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table") editor, int row, int column)
Prepares the editor by querying the data model for the value and selection state of the cell at row
, column
.
[Component](../../java/awt/Component.html "class in java.awt")
[prepareRenderer](../../javax/swing/JTable.html#prepareRenderer-javax.swing.table.TableCellRenderer-int-int-)([TableCellRenderer](../../javax/swing/table/TableCellRenderer.html "interface in javax.swing.table") renderer, int row, int column)
Prepares the renderer by querying the data model for the value and selection state of the cell at row
, column
.
boolean
[print](../../javax/swing/JTable.html#print--)()
A convenience method that displays a printing dialog, and then prints this JTable
in mode PrintMode.FIT_WIDTH
, with no header or footer text.
boolean
[print](../../javax/swing/JTable.html#print-javax.swing.JTable.PrintMode-)([JTable.PrintMode](../../javax/swing/JTable.PrintMode.html "enum in javax.swing") printMode)
A convenience method that displays a printing dialog, and then prints this JTable
in the given printing mode, with no header or footer text.
boolean
[print](../../javax/swing/JTable.html#print-javax.swing.JTable.PrintMode-java.text.MessageFormat-java.text.MessageFormat-)([JTable.PrintMode](../../javax/swing/JTable.PrintMode.html "enum in javax.swing") printMode,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") headerFormat,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") footerFormat)
A convenience method that displays a printing dialog, and then prints this JTable
in the given printing mode, with the specified header and footer text.
boolean
[print](../../javax/swing/JTable.html#print-javax.swing.JTable.PrintMode-java.text.MessageFormat-java.text.MessageFormat-boolean-javax.print.attribute.PrintRequestAttributeSet-boolean-)([JTable.PrintMode](../../javax/swing/JTable.PrintMode.html "enum in javax.swing") printMode,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") headerFormat,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") footerFormat, boolean showPrintDialog,[PrintRequestAttributeSet](../../javax/print/attribute/PrintRequestAttributeSet.html "interface in javax.print.attribute") attr, boolean interactive)
Prints this table, as specified by the fully featuredprint method, with the default printer specified as the print service.
boolean
[print](../../javax/swing/JTable.html#print-javax.swing.JTable.PrintMode-java.text.MessageFormat-java.text.MessageFormat-boolean-javax.print.attribute.PrintRequestAttributeSet-boolean-javax.print.PrintService-)([JTable.PrintMode](../../javax/swing/JTable.PrintMode.html "enum in javax.swing") printMode,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") headerFormat,[MessageFormat](../../java/text/MessageFormat.html "class in java.text") footerFormat, boolean showPrintDialog,[PrintRequestAttributeSet](../../javax/print/attribute/PrintRequestAttributeSet.html "interface in javax.print.attribute") attr, boolean interactive,[PrintService](../../javax/print/PrintService.html "interface in javax.print") service)
Prints this JTable
.
protected boolean
[processKeyBinding](../../javax/swing/JTable.html#processKeyBinding-javax.swing.KeyStroke-java.awt.event.KeyEvent-int-boolean-)([KeyStroke](../../javax/swing/KeyStroke.html "class in javax.swing") ks,[KeyEvent](../../java/awt/event/KeyEvent.html "class in java.awt.event") e, int condition, boolean pressed)
Invoked to process the key bindings for ks
as the result of the KeyEvent
e
.
void
[removeColumn](../../javax/swing/JTable.html#removeColumn-javax.swing.table.TableColumn-)([TableColumn](../../javax/swing/table/TableColumn.html "class in javax.swing.table") aColumn)
Removes aColumn
from this JTable
's array of columns.
void
[removeColumnSelectionInterval](../../javax/swing/JTable.html#removeColumnSelectionInterval-int-int-)(int index0, int index1)
Deselects the columns from index0
to index1
, inclusive.
void
[removeEditor](../../javax/swing/JTable.html#removeEditor--)()
Discards the editor object and frees the real estate it used for cell rendering.
void
[removeNotify](../../javax/swing/JTable.html#removeNotify--)()
Calls the unconfigureEnclosingScrollPane
method.
void
[removeRowSelectionInterval](../../javax/swing/JTable.html#removeRowSelectionInterval-int-int-)(int index0, int index1)
Deselects the rows from index0
to index1
, inclusive.
protected void
[resizeAndRepaint](../../javax/swing/JTable.html#resizeAndRepaint--)()
Equivalent to revalidate
followed by repaint
.
int
[rowAtPoint](../../javax/swing/JTable.html#rowAtPoint-java.awt.Point-)([Point](../../java/awt/Point.html "class in java.awt") 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
[selectAll](../../javax/swing/JTable.html#selectAll--)()
Selects all rows, columns, and cells in the table.
void
[setAutoCreateColumnsFromModel](../../javax/swing/JTable.html#setAutoCreateColumnsFromModel-boolean-)(boolean autoCreateColumnsFromModel)
Sets this table's autoCreateColumnsFromModel
flag.
void
[setAutoCreateRowSorter](../../javax/swing/JTable.html#setAutoCreateRowSorter-boolean-)(boolean autoCreateRowSorter)
Specifies whether a RowSorter
should be created for the table whenever its model changes.
void
[setAutoResizeMode](../../javax/swing/JTable.html#setAutoResizeMode-int-)(int mode)
Sets the table's auto resize mode when the table is resized.
void
[setCellEditor](../../javax/swing/JTable.html#setCellEditor-javax.swing.table.TableCellEditor-)([TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table") anEditor)
Sets the active cell editor.
void
[setCellSelectionEnabled](../../javax/swing/JTable.html#setCellSelectionEnabled-boolean-)(boolean cellSelectionEnabled)
Sets whether this table allows both a column selection and a row selection to exist simultaneously.
void
[setColumnModel](../../javax/swing/JTable.html#setColumnModel-javax.swing.table.TableColumnModel-)([TableColumnModel](../../javax/swing/table/TableColumnModel.html "interface in javax.swing.table") columnModel)
Sets the column model for this table to newModel
and registers for listener notifications from the new column model.
void
[setColumnSelectionAllowed](../../javax/swing/JTable.html#setColumnSelectionAllowed-boolean-)(boolean columnSelectionAllowed)
Sets whether the columns in this model can be selected.
void
[setColumnSelectionInterval](../../javax/swing/JTable.html#setColumnSelectionInterval-int-int-)(int index0, int index1)
Selects the columns from index0
to index1
, inclusive.
void
[setDefaultEditor](../../javax/swing/JTable.html#setDefaultEditor-java.lang.Class-javax.swing.table.TableCellEditor-)([Class](../../java/lang/Class.html "class in java.lang")<?> columnClass,[TableCellEditor](../../javax/swing/table/TableCellEditor.html "interface in javax.swing.table") editor)
Sets a default cell editor to be used if no editor has been set in a TableColumn
.
void
[setDefaultRenderer](../../javax/swing/JTable.html#setDefaultRenderer-java.lang.Class-javax.swing.table.TableCellRenderer-)([Class](../../java/lang/Class.html "class in java.lang")<?> columnClass,[TableCellRenderer](../../javax/swing/table/TableCellRenderer.html "interface in javax.swing.table") renderer)
Sets a default cell renderer to be used if no renderer has been set in a TableColumn
.
void
[setDragEnabled](../../javax/swing/JTable.html#setDragEnabled-boolean-)(boolean b)
Turns on or off automatic drag handling.
void
[setDropMode](../../javax/swing/JTable.html#setDropMode-javax.swing.DropMode-)([DropMode](../../javax/swing/DropMode.html "enum in javax.swing") dropMode)
Sets the drop mode for this component.
void
[setEditingColumn](../../javax/swing/JTable.html#setEditingColumn-int-)(int aColumn)
Sets the editingColumn
variable.
void
[setEditingRow](../../javax/swing/JTable.html#setEditingRow-int-)(int aRow)
Sets the editingRow
variable.
void
[setFillsViewportHeight](../../javax/swing/JTable.html#setFillsViewportHeight-boolean-)(boolean fillsViewportHeight)
Sets whether or not this table is always made large enough to fill the height of an enclosing viewport.
void
[setGridColor](../../javax/swing/JTable.html#setGridColor-java.awt.Color-)([Color](../../java/awt/Color.html "class in java.awt") gridColor)
Sets the color used to draw grid lines to gridColor
and redisplays.
void
[setIntercellSpacing](../../javax/swing/JTable.html#setIntercellSpacing-java.awt.Dimension-)([Dimension](../../java/awt/Dimension.html "class in java.awt") intercellSpacing)
Sets the rowMargin
and the columnMargin
-- the height and width of the space between cells -- tointercellSpacing
.
void
[setModel](../../javax/swing/JTable.html#setModel-javax.swing.table.TableModel-)([TableModel](../../javax/swing/table/TableModel.html "interface in javax.swing.table") dataModel)
Sets the data model for this table to newModel
and registers with it for listener notifications from the new data model.
void
[setPreferredScrollableViewportSize](../../javax/swing/JTable.html#setPreferredScrollableViewportSize-java.awt.Dimension-)([Dimension](../../java/awt/Dimension.html "class in java.awt") size)
Sets the preferred size of the viewport for this table.
void
[setRowHeight](../../javax/swing/JTable.html#setRowHeight-int-)(int rowHeight)
Sets the height, in pixels, of all cells to rowHeight
, revalidates, and repaints.
void
[setRowHeight](../../javax/swing/JTable.html#setRowHeight-int-int-)(int row, int rowHeight)
Sets the height for row
to rowHeight
, revalidates, and repaints.
void
[setRowMargin](../../javax/swing/JTable.html#setRowMargin-int-)(int rowMargin)
Sets the amount of empty space between cells in adjacent rows.
void
[setRowSelectionAllowed](../../javax/swing/JTable.html#setRowSelectionAllowed-boolean-)(boolean rowSelectionAllowed)
Sets whether the rows in this model can be selected.
void
[setRowSelectionInterval](../../javax/swing/JTable.html#setRowSelectionInterval-int-int-)(int index0, int index1)
Selects the rows from index0
to index1
, inclusive.
void
[setRowSorter](../../javax/swing/JTable.html#setRowSorter-javax.swing.RowSorter-)([RowSorter](../../javax/swing/RowSorter.html "class in javax.swing")<? extends [TableModel](../../javax/swing/table/TableModel.html "interface in javax.swing.table")> sorter)
Sets the RowSorter
.
void
[setSelectionBackground](../../javax/swing/JTable.html#setSelectionBackground-java.awt.Color-)([Color](../../java/awt/Color.html "class in java.awt") selectionBackground)
Sets the background color for selected cells.
void
[setSelectionForeground](../../javax/swing/JTable.html#setSelectionForeground-java.awt.Color-)([Color](../../java/awt/Color.html "class in java.awt") selectionForeground)
Sets the foreground color for selected cells.
void
[setSelectionMode](../../javax/swing/JTable.html#setSelectionMode-int-)(int selectionMode)
Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.
void
[setSelectionModel](../../javax/swing/JTable.html#setSelectionModel-javax.swing.ListSelectionModel-)([ListSelectionModel](../../javax/swing/ListSelectionModel.html "interface in javax.swing") newModel)
Sets the row selection model for this table to newModel
and registers for listener notifications from the new selection model.
void
[setShowGrid](../../javax/swing/JTable.html#setShowGrid-boolean-)(boolean showGrid)
Sets whether the table draws grid lines around cells.
void
[setShowHorizontalLines](../../javax/swing/JTable.html#setShowHorizontalLines-boolean-)(boolean showHorizontalLines)
Sets whether the table draws horizontal lines between cells.
void
[setShowVerticalLines](../../javax/swing/JTable.html#setShowVerticalLines-boolean-)(boolean showVerticalLines)
Sets whether the table draws vertical lines between cells.
void
[setSurrendersFocusOnKeystroke](../../javax/swing/JTable.html#setSurrendersFocusOnKeystroke-boolean-)(boolean surrendersFocusOnKeystroke)
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/JTable.html#setTableHeader-javax.swing.table.JTableHeader-)([JTableHeader](../../javax/swing/table/JTableHeader.html "class in javax.swing.table") tableHeader)
Sets the tableHeader
working with this JTable
to newHeader
.
void
[setUI](../../javax/swing/JTable.html#setUI-javax.swing.plaf.TableUI-)([TableUI](../../javax/swing/plaf/TableUI.html "class in javax.swing.plaf") ui)
Sets the L&F object that renders this component and repaints.
void
[setUpdateSelectionOnSort](../../javax/swing/JTable.html#setUpdateSelectionOnSort-boolean-)(boolean update)
Specifies whether the selection should be updated after sorting.
void
[setValueAt](../../javax/swing/JTable.html#setValueAt-java.lang.Object-int-int-)([Object](../../java/lang/Object.html "class in java.lang") aValue, int row, int column)
Sets the value for the cell in the table model at row
and column
.
void
[sizeColumnsToFit](../../javax/swing/JTable.html#sizeColumnsToFit-boolean-)(boolean lastColumnOnly)
void
[sizeColumnsToFit](../../javax/swing/JTable.html#sizeColumnsToFit-int-)(int resizingColumn)
Obsolete as of Java 2 platform v1.4.
void
[sorterChanged](../../javax/swing/JTable.html#sorterChanged-javax.swing.event.RowSorterEvent-)([RowSorterEvent](../../javax/swing/event/RowSorterEvent.html "class in javax.swing.event") e)
RowSorterListener
notification that theRowSorter
has changed in some way.
void
[tableChanged](../../javax/swing/JTable.html#tableChanged-javax.swing.event.TableModelEvent-)([TableModelEvent](../../javax/swing/event/TableModelEvent.html "class in javax.swing.event") e)
Invoked when this table's TableModel
generates a TableModelEvent
.
protected void
[unconfigureEnclosingScrollPane](../../javax/swing/JTable.html#unconfigureEnclosingScrollPane--)()
Reverses the effect of configureEnclosingScrollPane
by replacing the columnHeaderView
of the enclosing scroll pane with null
.
void
[updateUI](../../javax/swing/JTable.html#updateUI--)()
Notification from the UIManager
that the L&F has changed.
void
[valueChanged](../../javax/swing/JTable.html#valueChanged-javax.swing.event.ListSelectionEvent-)([ListSelectionEvent](../../javax/swing/event/ListSelectionEvent.html "class in javax.swing.event") e)
Invoked when the row selection changes -- repaints to show the new selection.