javax.swing.event

Class TableModelEvent

public class TableModelEvent extends EventObject

An event that describes changes to a {@link TableModel}.

See Also:

Field Summary
static intALL_COLUMNS
A column index representing all columns.
protected intcolumn
The column in the table model that the event relates to.
static intDELETE
An event type indicating that one or more rows have been deleted from the model.
protected intfirstRow
The first row in the table model that the event relates to.
static intHEADER_ROW
A row index representing the header row.
static intINSERT
An event type indicating that one or more rows have been inserted into the model.
protected intlastRow
The last row in the table model that the event relates to.
protected inttype
The event type (one of {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}).
static intUPDATE
An event type indicating that data has been updated in the model.
Constructor Summary
TableModelEvent(TableModel source)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in all columns and rows.
TableModelEvent(TableModel source, int row)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in a single row across all columns.
TableModelEvent(TableModel source, int firstRow, int lastRow)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in the specified rows across all columns.
TableModelEvent(TableModel source, int firstRow, int lastRow, int column)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in the specified rows and column.
TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
Creates a new TableModelEvent indicating an operation of the specified type on the data in the specified rows and column.
Method Summary
intgetColumn()
Returns the affected column of this event.
intgetFirstRow()
Returns the first affected row of this event.
intgetLastRow()
Returns the last affected row of this event.
intgetType()
Returns the type of change indicated by this event (usually one of {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}).

Field Detail

ALL_COLUMNS

public static final int ALL_COLUMNS
A column index representing all columns.

column

protected int column
The column in the table model that the event relates to.

DELETE

public static final int DELETE
An event type indicating that one or more rows have been deleted from the model.

firstRow

protected int firstRow
The first row in the table model that the event relates to.

HEADER_ROW

public static final int HEADER_ROW
A row index representing the header row.

INSERT

public static final int INSERT
An event type indicating that one or more rows have been inserted into the model.

lastRow

protected int lastRow
The last row in the table model that the event relates to.

type

protected int type
The event type (one of {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}).

UPDATE

public static final int UPDATE
An event type indicating that data has been updated in the model.

Constructor Detail

TableModelEvent

public TableModelEvent(TableModel source)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in all columns and rows.

Parameters: source the source object (null not permitted).

Throws: IllegalArgumentException if source is null.

TableModelEvent

public TableModelEvent(TableModel source, int row)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in a single row across all columns.

Parameters: source the source object (null not permitted). row the updated row.

Throws: IllegalArgumentException if source is null.

TableModelEvent

public TableModelEvent(TableModel source, int firstRow, int lastRow)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in the specified rows across all columns.

Parameters: source the source object (null not permitted). firstRow the first row of update. lastRow the last row of update.

Throws: IllegalArgumentException if source is null.

TableModelEvent

public TableModelEvent(TableModel source, int firstRow, int lastRow, int column)
Creates a new TableModelEvent indicating an {@link #UPDATE} to the data in the specified rows and column. Use {@link #ALL_COLUMNS} for the column argument to indicate all columns.

Parameters: source the source object (null not permitted). firstRow the first row of update. lastRow the last row of update. column the affected column.

Throws: IllegalArgumentException if source is null.

TableModelEvent

public TableModelEvent(TableModel source, int firstRow, int lastRow, int column, int type)
Creates a new TableModelEvent indicating an operation of the specified type on the data in the specified rows and column. The event type is usually one of {@link #UPDATE}, {@link #INSERT}, and {@link #DELETE}.

Parameters: source the source object (null not permitted). firstRow the first row of update. lastRow the last row of update. column the affected column. type the type of change.

Throws: IllegalArgumentException if source is null.

Method Detail

getColumn

public int getColumn()
Returns the affected column of this event.

Returns: The column index.

getFirstRow

public int getFirstRow()
Returns the first affected row of this event.

Returns: The row index.

getLastRow

public int getLastRow()
Returns the last affected row of this event.

Returns: The row index.

getType

public int getType()
Returns the type of change indicated by this event (usually one of {@link #UPDATE}, {@link #INSERT}, {@link #DELETE}).

Returns: The type.