|
SpanModelEvent and SpanModelListener |
Top Previous Next |
DefaultSpanModel fires a SpanModelEvent every time a cell span is added or removed. You can listen for SpanModelEvents by creating a class that implements SpanModelListener and adding it to the SpanModel's SpanModelListeners list. For example, SpanDrawer contains an internal SpanModelListener that repaints the table's area that was affected by a cell span being added/removed.
Example: Create a SpanModelListener.
SpanModelListenerer mySpanModelListener = new SpanModelListener() {
public void spanChanged(SpanModelEvent e) {
int type = e.getType();
CellSpan cs = e.getCellSpan();
if (type = e.INSERT) {
…
}
if (type = e. DELETE) {
…
}
if (type = e. UPDATE) {
…
}
}
};
SpanDrawer drawer = table.getSpanDrawer();
SpanModel spanModel = drawer.getSpanModel();
spanModel.addSpanModelListener(mySpanModelListener);