Top Description Fields Constructors Methods
org.hsqldb.util

pack-priv Class GridSwing

extends AbstractTableModel
Class Inheritance
Imports
java.util.ArrayList, .Arrays, java.awt.Component, javax.swing.JTable, javax.swing.event.TableModelEvent, javax.swing.table.AbstractTableModel, .TableCellRenderer, .TableColumn, .TableModel

Simple table model to represent a grid of tuples.
Author
dmarshall@users
Since
1.7.0
Version
2.5.0

Field Summary

Modifier and TypeField and Description
pack-priv Object[]
pack-priv JTable
pack-priv ArrayList<Object[]>
Inherited from javax.swing.table.AbstractTableModel:
listenerList

Constructor Summary

AccessConstructor and Description
public
GridSwing()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addRow(Object[] r)

Append a tuple to the end of the table.

public static void
public void
clear()

Remove data from all cells in the table (without affecting the current headings).

public void
fireTableChanged(TableModelEvent e)

Overrides javax.swing.table.AbstractTableModel.fireTableChanged.

Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.

public Class<T>
getColumnClass(int i)

Overrides javax.swing.table.AbstractTableModel.getColumnClass.

Implements javax.swing.table.TableModel.getColumnClass.

Returns Object.class regardless of columnIndex.

public int
getColumnCount()

Implements javax.swing.table.TableModel.getColumnCount.

Get the number of columns.

public String
getColumnName(int i)

Overrides javax.swing.table.AbstractTableModel.getColumnName.

Implements javax.swing.table.TableModel.getColumnName.

Get the name for the specified column.

public ArrayList<Object[]>
getData()

Get the current table data.

public Object[]
getHead()

Get the current column headings.

public int
getRowCount()

Implements javax.swing.table.TableModel.getRowCount.

Get the number of rows currently in the table.

public Object
getValueAt(int row, int col)

Implements javax.swing.table.TableModel.getValueAt.

Get the object at the specified cell location.

public void
setHead(Object[] h)

Set the name of the column headings.

public void
Inherited from javax.swing.table.AbstractTableModel:
addTableModelListenerfindColumnfireTableCellUpdatedfireTableDataChangedfireTableRowsDeletedfireTableRowsInsertedfireTableRowsUpdatedfireTableStructureChangedgetListenersgetTableModelListenersisCellEditableremoveTableModelListenersetValueAt

Field Detail

headersback to summary
pack-priv Object[] headers
jtableback to summary
pack-priv JTable jtable
rowsback to summary
pack-priv ArrayList<Object[]> rows

Constructor Detail

GridSwingback to summary
public GridSwing()

Default constructor.

Method Detail

addRowback to summary
public void addRow(Object[] r)

Append a tuple to the end of the table.

autoSizeTableColumnsback to summary
public static void autoSizeTableColumns(JTable table)
clearback to summary
public void clear()

Remove data from all cells in the table (without affecting the current headings).

fireTableChangedback to summary
public void fireTableChanged(TableModelEvent e)

Overrides javax.swing.table.AbstractTableModel.fireTableChanged.

Doc from javax.swing.table.AbstractTableModel.fireTableChanged.

Forwards the given notification event to all TableModelListeners that registered themselves as listeners for this table model.

getColumnClassback to summary
public Class<T> getColumnClass(int i)

Overrides javax.swing.table.AbstractTableModel.getColumnClass.

Implements javax.swing.table.TableModel.getColumnClass.

Doc from javax.swing.table.AbstractTableModel.getColumnClass.

Returns Object.class regardless of columnIndex.

getColumnCountback to summary
public int getColumnCount()

Implements javax.swing.table.TableModel.getColumnCount.

Get the number of columns.

getColumnNameback to summary
public String getColumnName(int i)

Overrides javax.swing.table.AbstractTableModel.getColumnName.

Implements javax.swing.table.TableModel.getColumnName.

Get the name for the specified column.

getDataback to summary
public ArrayList<Object[]> getData()

Get the current table data. Each row is represented as a String[] with a single non-null value in the 0-relative column position.

The first row is at offset 0, the nth row at offset n etc.

getHeadback to summary
public Object[] getHead()

Get the current column headings.

getRowCountback to summary
public int getRowCount()

Implements javax.swing.table.TableModel.getRowCount.

Get the number of rows currently in the table.

getValueAtback to summary
public Object getValueAt(int row, int col)

Implements javax.swing.table.TableModel.getValueAt.

Get the object at the specified cell location.

setHeadback to summary
public void setHead(Object[] h)

Set the name of the column headings.

setJTableback to summary
public void setJTable(JTable table)