Paul Brinkley wrote:

> At 12:05 PM 3/3/01 +0530, J.Ganesan wrote:
> >Hi all,
> > I have a class X , which extends AbstractTableModel. When I save an
> >object of X, the JTable whose TableModel is  the object of X, is also
> >serialized and saved. I am interseted ONLY in the private data of X.
> >Besides, the file size becomes unacceptably big.
> > Any suggestions to solve this problem ?
> > Thanks.
>
> If you're only interested in an X's private data, you should
> probably extract it explicitly and save it, rather than
> trying to serialize the X object itself.  The reason for
> this is that some other class may need to save the state
> of the entire X object, including any JTables it references.

How can we do this ? Because, even if we implement writeObject() method
for the private data , the defaultWriteObject() method operates on super
class .
With the result that JTable is also serialized.



>
>
> (However, I was always under the impression that listeners
> to Swing objects were NOT serialized by design; listeners
> are transient.

No. listenerList is a protected non-transient field in AbstractTableModel.

> A JTable would be such a listener.  I'm not
> quite sure why this X object references a JTable
> non-transiently.)
>
> I could go into more detail about writing custom serialization
> code,

Pls tell me how to implement a custom serialzaton for this.

ganesan

> including externalization if it comes to that, but I'm
> not even sure such things would be appropriate here.

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to