Class UneditableDefaultTableModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class UneditableDefaultTableModel
    extends javax.swing.table.DefaultTableModel
    A DefaultTableModel that has been modified to mark the cells as uneditable.

    Modified by: Joseph A. Huwaldt

    Version:
    December 21, 2014
    Author:
    Joseph A. Huwaldt Date: January 29, 2014
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      UneditableDefaultTableModel()
      Constructs a default UneditableDefaultTableModel which is a table of zero columns and zero rows.
      UneditableDefaultTableModel​(int rowCount, int columnCount)
      Constructs a UneditableDefaultTableModel with rowCount and columnCount of null object values.
      UneditableDefaultTableModel​(java.lang.Object[][] data, java.lang.Object[] columnNames)
      Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method.
      UneditableDefaultTableModel​(java.lang.Object[] columnNames, int rowCount)
      Constructs a UneditableDefaultTableModel with as many columns as there are elements in columnNames and rowCount of null object values.
      UneditableDefaultTableModel​(java.util.List data, java.util.List columnNames)
      Constructs a UneditableDefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method.
      UneditableDefaultTableModel​(java.util.Vector columnNames, int rowCount)
      Constructs a UneditableDefaultTableModel with as many columns as there are elements in columnNames and rowCount of null object values.
      UneditableDefaultTableModel​(java.util.Vector data, java.util.Vector columnNames)
      Constructs a UneditableDefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isCellEditable​(int row, int column)
      Returns false regardless of parameter values.
      • Methods inherited from class javax.swing.table.DefaultTableModel

        addColumn, addColumn, addColumn, addRow, addRow, getColumnCount, getColumnName, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
      • Methods inherited from class javax.swing.table.AbstractTableModel

        addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UneditableDefaultTableModel

        public UneditableDefaultTableModel()
        Constructs a default UneditableDefaultTableModel which is a table of zero columns and zero rows.
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(int rowCount,
                                           int columnCount)
        Constructs a UneditableDefaultTableModel with rowCount and columnCount of null object values.
        Parameters:
        rowCount - the number of rows the table holds
        columnCount - the number of columns the table holds
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(java.util.Vector columnNames,
                                           int rowCount)
        Constructs a UneditableDefaultTableModel with as many columns as there are elements in columnNames and rowCount of null object values. Each column's name will be taken from the columnNames vector.
        Parameters:
        columnNames - vector containing the names of the new columns; if this is null then the model has no columns
        rowCount - the number of rows the table holds
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(java.lang.Object[] columnNames,
                                           int rowCount)
        Constructs a UneditableDefaultTableModel with as many columns as there are elements in columnNames and rowCount of null object values. Each column's name will be taken from the columnNames array.
        Parameters:
        columnNames - array containing the names of the new columns; if this is null then the model has no columns
        rowCount - the number of rows the table holds
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(java.util.Vector data,
                                           java.util.Vector columnNames)
        Constructs a UneditableDefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method.
        Parameters:
        data - the data of the table, a Vector of Vectors of Object values
        columnNames - vector containing the names of the new columns
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(java.util.List data,
                                           java.util.List columnNames)
        Constructs a UneditableDefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method.
        Parameters:
        data - the data of the table, a List of Lists of Object values
        columnNames - vector containing the names of the new columns
      • UneditableDefaultTableModel

        public UneditableDefaultTableModel​(java.lang.Object[][] data,
                                           java.lang.Object[] columnNames)
        Constructs a DefaultTableModel and initializes the table by passing data and columnNames to the setDataVector method. The first index in the Object[][] array is the row index and the second is the column index.
        Parameters:
        data - the data of the table
        columnNames - the names of the columns
    • Method Detail

      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int column)
        Returns false regardless of parameter values.
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.DefaultTableModel
        Parameters:
        row - the row whose value is to be queried
        column - the column whose value is to be queried
        Returns:
        Always returns false.