Interface IJTable

All Superinterfaces:
IComponent, IContainer, IJComponent
All Known Implementing Classes:
JTableImpl

public interface IJTable extends IJComponent
Author:
thevpc
  • Method Details

    • convertRowIndexToView

      int convertRowIndexToView(int i)
    • convertRowIndexToModel

      int convertRowIndexToModel(int i)
    • convertColumnIndexToView

      int convertColumnIndexToView(int i)
    • convertColumnIndexToModel

      int convertColumnIndexToModel(int i)
    • setModel

      void setModel(TableModel dataModel)
    • getModel

      TableModel getModel()
    • getComponent

      Component getComponent()
    • setSelectionMode

      void setSelectionMode(int selectionMode)
      Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.

      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.

      See Also:
    • setRowSelectionAllowed

      void setRowSelectionAllowed(boolean rowSelectionAllowed)
      Sets whether the rows in this model can be selected.
      Parameters:
      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.
    • getSelectionModel

      ListSelectionModel getSelectionModel()
      Returns the ListSelectionModel that is used to maintain row selection state.
      Returns:
      the object that provides row selection state, null if row selection is not allowed
    • getSelectedRow

      int getSelectedRow()
      Returns the index of the first selected row, -1 if no row is selected.
      Returns:
      the index of the first selected row
    • getSelectedColumn

      int getSelectedColumn()
      Returns the index of the first selected column, -1 if no column is selected.
      Returns:
      the index of the first selected column
    • setDefaultRenderer

      void setDefaultRenderer(Class<?> columnClass, TableCellRenderer renderer)
      Sets a default cell renderer to be used if no renderer has been set in a TableColumn. If renderer is null, removes the default renderer for this column class.
      Parameters:
      columnClass - set the default cell renderer for this columnClass
      renderer - default cell renderer to be used for this columnClass
    • setRowSelectionInterval

      void setRowSelectionInterval(int index0, int index1)
      Selects the rows from index0 to index1, inclusive.
      Parameters:
      index0 - one end of the interval
      index1 - the other end of the interval
      Throws:
      IllegalArgumentException - if index0 or index1 lie outside [0, getRowCount()-1]
    • getCellRect

      Rectangle getCellRect(int row, int column, boolean includeSpacing)
      Returns a rectangle for the cell that lies at the intersection of 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.

      Parameters:
      row - the row index where the desired cell is located
      column - 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 index
      includeSpacing - if false, return the true cell bounds - computed by subtracting the intercell spacing from the height and widths of the column and row models
      Returns:
      the rectangle containing the cell at location row,column
    • columnAtPoint

      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].
      Parameters:
      point - the location of interest
      Returns:
      the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount()-1]
      See Also:
    • rowAtPoint

      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].
      Parameters:
      point - the location of interest
      Returns:
      the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount()-1]
      See Also:
    • setToolTipText

      void setToolTipText(String text)
      Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

      See How to Use Tool Tips in The Java Tutorial for further documentation.

      Parameters:
      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.
    • getColumnModel

      TableColumnModel getColumnModel()
      Returns the TableColumnModel that contains all column information of this table.
      Returns:
      the object that provides the column state of the table
    • getSelectedRows

      int[] getSelectedRows()
      Returns the indices of all selected rows.
      Returns:
      an array of integers containing the indices of all selected rows, or an empty array if no row is selected
      See Also: