Saving an Object that has been painted
I have two classes (A Paint class and a Save Object Class). I want to be able to save the image that has been drawn to a file through a menu option. Below is the code I have. I get an error message telling me that it "Cannot Resolve Symbol". It points to the "SaveObject();" line. Could someone tell me if I'm going about this the right way and if so, why do I ge that error message.
***********Paint Class************
private JMenuItem createFileOptionSave()
{
final JMenuItem optionSave = new JMenuItem("Save");
optionSave.addActionListener
(
new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
SaveObject();
}
}
);
return optionSave;
}
*********Save Object Class*************
import java.io.*;
public class SaveObject
{
public static void main(String[] args)
{
try
{
ObjectOutputStream objOut =
new ObjectOutputStream(new FileOutputStream("ObjectFile.dat"));
JPanel paintPanel = new JPanel(paintPanel);
objOut.saveObject(paintPanel);
objOut.close();
}
catch (IOException ioe){ioe.printStackTrace();}
}
}

