public class MSketch extends Object implements Externalizable
The Swing and AWT ancestor classes of MSketchPane (like JComponent) have different serialVersionUID values in different Java versions, thus its simple serialization and deserialization with another Java version may not work. The workaround is to serialize class MSketch instead, which only extends Object and has a fixed serialVersionUID.
Constructor and Description |
---|
MSketch()
Constructor used for deserialization.
|
MSketch(MSketchPane p)
Constructor used for serialization.
|
Modifier and Type | Method and Description |
---|---|
MSketchPane |
getMSketchPane() |
void |
readExternal(ObjectInput in)
Restores the sketcher's state.
|
void |
writeExternal(ObjectOutput out)
Saves the sketcher's state.
|
public MSketch()
public MSketch(MSketchPane p)
p
- the sketcher bean to serializepublic MSketchPane getMSketchPane()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- the stream to read data from in order to restore the objectIOException
- if I/O errors occurClassNotFoundException
- If the class for an object being restored cannot be found.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- the stream to write the object toIOException
- Includes any I/O exceptions that may occur