Serialisation not working
What objects include the com.apple.laf.AquaMenuBarBorder object? i know that JMenuBars do so i can't serialise those.
I am trying to serialise a class that holds the following variables
Code :
JButtonExt[][] board;
int extraWidth;
Turn currentClick = Turn.One;
Player currentPlayer;
Player[] players;
String[][] playerInfo;
int numSquares;
int squaresWide;
int squaresHigh;
boolean waiting = false;
boolean useDB;
BoardType boardType;
GameType gameType;
Dimension gameBoardBounds;
the JButtonExt class holds strings, booleans, ImageIcon, while the player class holds strings, int, JLabels and JButtonExt. BoardType and GameType are both enums.
Re: Serialisation not working
How do you know it's not working? Are you getting an error or something?
Re: Serialisation not working
Have you implemented the Serializable interface?
Re: Serialisation not working
yeah i have implemented the serialisable interface on every class that I. I know that it fails because it tells me that the JMenuBar is not serialisable and stops the code
Re: Serialisation not working
Break the problem down....try to serialize each one of those by themselves. I would presume when you do so one will manifest the problem, which you can further diagnose in a similar manner. I presume you are on a mac given the class you mention (eg *Aqua) - are serializing a JFrame anywhere within the code?
Re: Serialisation not working
yeah I've tried that. but i can get all of them to work by themselves. i can get it to work by setting some of them transient and working out which ones actually work but it may work the first time and doing everything exactly the same the next time it won't work. yes i am on a mac and this is the only time i serialise any piece of code.
Re: Serialisation not working
Then I recommend posting an SSCCE which will allow someone to reproduce the problem. Somewhere in your code is a non serializable object (probably a JMenuBar), whether directly or indirectly, and based upon what you posted we cannot help find it.
Re: Serialisation not working
its all good. I've found a way to save it using a database. i know its probably not as good but i already has a database in my application and have used sql before