< Day Day Up > |
Each JTable object has a table model that holds its data. When a table model listener is registered on the table model, the listener is notified every time the table model's data changes. The JTable itself automatically uses a table model listener to make its GUI reflect the current state of the table model. You register a table model listener using the TableModel addTableModelListener method. For more information on tables, see How to Use Tables (page 388) in Chapter 7. In particular, the section Detecting Data Changes (page 397) discusses and shows an example of implementing a table model listener. The Table Model Listener APITable 33 lists the methods in the TableModelListener interface and Table 34 describes the methods in the TableModelEvent class. Note that TableModelListener has only one method, so it has no corresponding adapter class. Also refer to the TableModelListener API documentation online at: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/event/TableModelListener.html. The TableModelEvent API documentation is online at: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/event/Table-ModelEvent.html. Table 33. The TableModelListener Interface
Table 34. The TableModelEvent API
Examples That Use Table Model ListenersThe following examples are related to table model listeners.
|
< Day Day Up > |