gui
Class AddressBookFrame.MyTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--gui.AddressBookFrame.MyTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Enclosing class:
AddressBookFrame

class AddressBookFrame.MyTableModel
extends javax.swing.table.AbstractTableModel

TableModel


Field Summary
private  java.lang.String[] columnNames
          Kolumnrubriker.
private  java.util.Vector data
          Innehåller adressboken.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AddressBookFrame.MyTableModel()
          Skapar ny modell.
 
Method Summary
 void addRow()
          Lägger till en rad i modellen.
 java.lang.Class getColumnClass(int c)
          Returns the most specific superclass for all the cell values in the column.
 int getColumnCount()
          Returns the number of columns in the model.
 java.lang.String getColumnName(int col)
          Returns the name of the column at col.
 java.util.Vector getData()
          Returnerar en Vector innehållande modellens data.
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int row, int col)
          Returns the value for the cell at col and row.
 boolean isCellEditable(int row, int col)
          Returns true if the cell at row and col is editable.
 void removeRow(int row)
          Tar bort en rad i modellen.
 void setData(java.util.Vector data)
          Sätter modellens data.
 void setValueAt(java.lang.Object value, int row, int col)
          Sets the value in the cell at col and row to value.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnNames

private java.lang.String[] columnNames
Kolumnrubriker.


data

private java.util.Vector data
Innehåller adressboken.

Constructor Detail

AddressBookFrame.MyTableModel

public AddressBookFrame.MyTableModel()
Skapar ny modell.

Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Returns:
the number of columns in the model.

getRowCount

public int getRowCount()
Returns the number of rows in the model.

Returns:
the number of rows in the model.

getColumnName

public java.lang.String getColumnName(int col)
Returns the name of the column at col.

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

getData

public java.util.Vector getData()
Returnerar en Vector innehållande modellens data.

Returns:
modellens data.

setData

public void setData(java.util.Vector data)
Sätter modellens data.

Parameters:
data - modellens data.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Returns the value for the cell at col and row.

Parameters:
row - the row whose value is to be queried.
col - the column whose value is to be queried.
Returns:
the value Object at the specified cell.

getColumnClass

public java.lang.Class getColumnClass(int c)
Returns the most specific superclass for all the cell values in the column.

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - the index of the column.
Returns:
the common ancestor class of the object values in the model.

addRow

public void addRow()
Lägger till en rad i modellen.


removeRow

public void removeRow(int row)
Tar bort en rad i modellen.

Parameters:
row - radnumret.

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Returns true if the cell at row and col is editable. Otherwise, setValueAt on the cell will not change the value of that cell.

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row - the row whose value to be queried.
col - the column whose value to be queried.
Returns:
true if the cell is editable.

setValueAt

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

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
value - the new value.
row - the row whose value is to be changed.
col - the column whose value is to be changed.