I'm not sure what the problem is, but I'd try to pinpoint the source of the
problem a little further. First, make sure that your addTableModelListener
method is
really being called by adding some tracing or logging to that method. (This
will ensure
you're picking up the right version of the class.) Next, make sure that the
listener object
that the method receives is non-null. Then try creating a another
TableModelListener,
separate from the JTable, try adding that as a listener to the TableModel,
and see if it
picks up the events.
If the behaviour that you want to trace is in the AbstractTableModel, then
take a copy
from Sun's sources, modify that and put in on your classpath in the
appropriate place
(this might have to be the bootclasspath?)
Good luck!
Simon
--
www.catalysoft.com - increasing the rate of your software development
"Jorge Castro" <> wrote in message
news:bfrfhm$ci2$...
> HI,
>
> I would be gratefull for any suggestions that might clarify the following
>
> Problem: can't add a JTable to the listener list of a subclass
> of AbstractTableModel.
>
> In my programme I instatiate a DataTable and pass it to a JTable
> contructor,
>
> dataModel = new DataTable();
> JTable jt = new JTable(dataModel);
> //following line may not be neccessary as
> //the JTable constructor should do this!
> dataModel.addTableModelListener(jt);
>
> where,
> public DataTable extends AbstractTableModel implements SomeOtherInterface;
>
> My objective it to relay remote events to the listeners of my DataTable,
ie
> the JTable.
> However, this does not seem to be working. While trying to trace the cause
> of the problem, I inspected the list of registered listeners of the
> DataTable in my programme (by examining the field "listenerList" of the
> AbstractTableModel):
>
> listenerList.toString();
> System.out.println("Listeners in listenerList: "
> + listenerList.getListenerCount());
>
> and, to my surprise, there are zero listeners!
>
> Why is the JTable not been registered as a listener?
>
>
> Jorge Castro
>
>