Serializing swing/awt components

前端 未结 4 1036
执念已碎
执念已碎 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:34

    To serialize an object, all the objects it references need to also be serializable aswell. You can mark a reference transient if you don't want it to be serialized. This means, if your panel refers to objects which are not serilizable, make them serilizable aswell or mark them transient

提交回复
热议问题