Serializing swing/awt components

前端 未结 4 1083
执念已碎
执念已碎 2021-01-27 18:01

I am trying to serialize a JPanel but everytime i get this error:

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: javax.swing         


        
4条回答
  •  不知归路
    2021-01-27 18:43

    To be serializeable the object (and all the parts of it with exception of the POJOs) needs to implement the Serializable interface.

    If you cannot change the class, take a look at XStream.

提交回复
热议问题