org.opensourcephysics.tools
Class ArrayTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.opensourcephysics.tools.ArrayTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class ArrayTableModel
extends javax.swing.table.AbstractTableModel

A table model for an ArrayTable.

Version:
1.0
Author:
Douglas Brown
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ArrayTableModel(boolean[] array)
           
ArrayTableModel(boolean[][] array)
           
ArrayTableModel(double[] array)
           
ArrayTableModel(double[][] array)
           
ArrayTableModel(int[] array)
           
ArrayTableModel(int[][] array)
           
ArrayTableModel(java.lang.String[] array)
           
ArrayTableModel(java.lang.String[][] array)
           
 
Method Summary
 int getColumnCount()
          Gets the number of columns.
 java.lang.String getColumnName(int column)
          Gets the name of the specified column.
 int getRowCount()
          Gets the number of rows.
 java.lang.Object getValueAt(int row, int column)
          Gets the value at the given cell.
 boolean isCellEditable(int row, int col)
          Determines whether the given cell is editable.
 void setEditable(boolean editable)
           
 void setValueAt(java.lang.Object value, int row, int col)
          Sets the value at the given cell.
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayTableModel

public ArrayTableModel(int[] array)

ArrayTableModel

public ArrayTableModel(int[][] array)

ArrayTableModel

public ArrayTableModel(double[] array)

ArrayTableModel

public ArrayTableModel(double[][] array)

ArrayTableModel

public ArrayTableModel(java.lang.String[] array)

ArrayTableModel

public ArrayTableModel(java.lang.String[][] array)

ArrayTableModel

public ArrayTableModel(boolean[] array)

ArrayTableModel

public ArrayTableModel(boolean[][] array)
Method Detail

setEditable

public void setEditable(boolean editable)

getColumnCount

public int getColumnCount()
Gets the number of columns.

Returns:
the column count

getColumnName

public java.lang.String getColumnName(int column)
Gets the name of the specified column.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - the column index
Returns:
the column name

getRowCount

public int getRowCount()
Gets the number of rows.

Returns:
the row count

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Gets the value at the given cell.

Parameters:
row - the row index
column - the column index
Returns:
the value

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Determines whether the given cell is editable.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the row index
col - the column index
Returns:
true if editable

setValueAt

public void setValueAt(java.lang.Object value,
                       int row,
                       int col)
Sets the value at the given cell.

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - the value
row - the row index
col - the column index