Class SimpleTableModel

    • Field Detail

      • COMPARABLE_COMPARATOR

        public static final ComparableComparator COMPARABLE_COMPARATOR
        A simple comparator that compares comparables, for use in sorting e.g. columns containing Strings.
    • Constructor Detail

      • SimpleTableModel

        public SimpleTableModel​(List<? extends List<? extends Serializable>> data)
        Creates a SimpleTableDataModel containing the given data.
        Parameters:
        data - the table data, the outer list containing rows.
      • SimpleTableModel

        public SimpleTableModel​(Serializable[][] data)
        Creates a SimpleTableDataModel containing the given data.
        Parameters:
        data - the table data, the outer array containing rows.
    • Method Detail

      • getData

        public Serializable[][] getData()
        Returns:
        the data for this model
      • setComparator

        public void setComparator​(int col,
                                  Comparator comparator)
        Sets the comparator for the given column, to enable sorting.
        Parameters:
        col - the column to set the comparator on.
        comparator - the comparator to set.
      • getRowCount

        public int getRowCount()
        Retrieves the number of rows.
        Returns:
        the number of rows in the model for this level.
      • getValueAt

        public Object getValueAt​(int row,
                                 int col)
        Retrieves the value at the given row and column.
        Parameters:
        row - - the row index.
        col - - the column index. Column of -1 indicates row has a renderer.
        Returns:
        the value at the given row and column.
      • isEditable

        public boolean isEditable()
        Indicates whether the data in this model is editable.
        Returns:
        true if the data in this model is editable, false otherwise.
      • setEditable

        public void setEditable​(boolean editable)
        Sets whether the data in this model is editable. By default, the data is not editable.
        Parameters:
        editable - true if the data is editable, false if it is read-only.