I am trying to serialize a JPanel but everytime i get this error:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: javax.swing
GroupLayout, which appears to have been added to the panel, is not serialisable. There are a few options (listed least to most favourable).
Subclass GroupLayout to create a serial proxy (see Effective Java 2nd Ed). This is a fair bit of work, and is complicated by GroupLayout not having a complete set of "getters and setters".
Replace GroupLayout with a serialisable LayoutManager. There's the functional but rough GridBagLayout in the Java library. Other layout managers are available.
Don't serialise the JPanel. Making AWT components serialisable (and the whole JavaBeans thing) was a laughable mistake.