Dear all:
I have a problem regarding save and load java3d file. In my
program, I will have to save a group of shape to a file, in other word,
write all the Branchgroup to a file, and I should be able to read it back.
I used serialization. However, this return with a Exception:
NotSerializable java3d.Branchgroup.
If you know the answer, can you let me know asap.
Such methods as:
public void saveJewel()
{
//Create a file dialog to get the filname from a user
FileDialog saveFile = new FileDialog(new JFrame(),"save",
FileDialog.SAVE);
saveFile.show();//display the dialog and block.
String filename = saveFile.getFile(); //get user respond
if(filename !=null) //if user didn't click cancel
{
try
{
FileOutputStream fos = new FileOutputStream(filename);
GZIPOutputStream gzips = new GZIPOutputStream(fos);
ObjectOutputStream outs = new ObjectOutputStream(gzips);
outs.writeObject(branchList);//Write the entire vector of
the object
outs.flush();//flush the output
outs.close();//close the stream
}
catch(IOException e)//print out exceptions
{
System.out.println(e);
}
}
}
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/