Article View: borland.public.jbuilder.java.language
Article #16410Serialization
From: Bobby Healy
Date: Sun, 28 Feb 1999 00:00
Date: Sun, 28 Feb 1999 00:00
47 lines
2081 bytes
2081 bytes
I want to be able to save to disk the entire state of a
piece of my dialog. It's basically a listbox defined
as follows-:
public class rwd_writablevectormodel extends
ListControl implements WritableVectorModel,Serializable
I'm saving it to disk as follows-:
FileOutputStream outstream = new FileOutputStream(name);
ObjectOutputStream out = new ObjectOutputStream(outstream);
out.writeObject(cListbox);
out.close();
and reloading it as follows-:
FileInputStream instream = new FileInputStream(name);
ObjectInputStream in = new ObjectInputStream(instream);
rwd_writablevectormodel rc=(rwd_writablevectormodel)in.readObject();
When I try to work with the loaded object (to add a listner),
I get the following exception-:
System Error: Exception occurred during event dispatching:
System Error: java.lang.NullPointerException
System Error: at borland.jbcl.view.ListCore.addSelectionListener(Compiled Code)
System Error: at borland.jbcl.view.ListView.addSelectionListener(Compiled Code)
The code to add the handler is as follows-:
jPanelList.addSelectionListener(new
borland.jbcl.model.VectorSelectionAdapter()
{
public void selectionChanged(VectorSelectionEvent e)
{
jPanelList_selectionChanged(e);
}
});
Any ideas ? Am I crazy trying to writ ean entire liscontrol object to
disk and reload it ? I loved the old C++ days, when I could just dig
around the lower level code to find out why my higher level code
was dying...
--
Rgds,
Bobby
Technical Details
Message-ID:
<36D94AF3.850A8893@vti.ie>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,973a663a06213fa8,start X-Google-Attributes: gidf74b3,public From: Bobby Healy <bhealy@vti.ie> Subject: Serialization Date: 1999/02/28 Message-ID: <36D94AF3.850A8893@vti.ie> X-Deja-AN: 449513697 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: VTI Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language