| awahl@yahoo.com 2005-11-10, 7:56 am |
| Hello,
I have derived a class from JDialog that I would like to serialize via
the XMLEncoder
public class DerivedDialog extends JDialog {
JTextArea text = new JTextArea();
public DerivedDialog () {
setDefaultCloseOperation(DISPOSE_ON_CLOS
E);
getContentPane().add(text);
setSize(300, 300);
setVisible(true);
}
}
with
DerivedDialog dialog = new DerivedDialog();
XMLEncoder e = new XMLEncoder(System.out);
e.setPersistenceDelegate(GauchoDialog.class,
e.getPersistenceDelegate(JDialog.class));
e.writeObject(dialog);
e.close();
I would have expected that the text written in the TextArea would have
been also serialized in the XML. As it is done when I don't derived
JDialog
with JDialog dialog = new JDialog();
JTextArea text = new JTextArea();
dialog,.getContentPane().add(text);
dialog,setSize(300, 300);
dialoh.setVisible(true);
How can I make this inherited class behave towards XMLEncoder as did
JDialog?
Thank you
|