Re: Error



Oliver wrote:
I may be wrong, but the error message you're getting,
java.io.NotSerializableException: sun.awt.image.OffScreenImage, seems
to tell me that inside one of your classes there is an
"OffScreenImage". It is this object which is not serializable.

To the best of my knowledge, objects in your class must be
serializable, not just your class itself. Are you sure that
OffScreenImages, a part of the sun.awt.* packages, is serializable?

Maybe you need to subclass OffScreenImage and write a serialization
routine for it. Just an idea, I am not sure if that is the best way to
fix it.

Any reference to a sun.* class, let alone subclassing, is probably a bad idea. Even if it does have an accessible no-args constructor, you still need to save and restore the data.


Generally Image subclasses are not serialisable, so references to Image in serialisable classes should be marked transient. If data needs to be saved, provide the usual readObject and writeObject methods.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.