dcsimg
java.lang.Exception: discarding statement JPanel0.add(JTextField0)
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Fabien_Fischer
Posted On:   Thursday, May 16, 2002 04:30 AM

This message appears when I try to save a Panel with all subcomponents. My programm saves JLabel in the resulting Xml-file but neither JTextField nor JComboBox, etc. I've checked my classes, and all subcomponents of my Spanel are JavaBeans. (Spanel extends JPanel and has a no-args constructor as well). So is it a JDK bug? Hope somebody can help me. This is my program : ******* public static void serializeContainer(Container spanel,String fileName) throws IOException { FileOutputStream fos = new FileOutputStream(fileName); XMLEncoder encoder = new XMLEncoder(fos); encoder.setExceptionListener(new ExceptionListener() {    More>>

This message appears when I try to save a Panel with all subcomponents.
My programm saves JLabel in the resulting Xml-file but neither JTextField nor JComboBox, etc.
I've checked my classes, and all subcomponents of my Spanel are JavaBeans.
(Spanel extends JPanel and has a no-args constructor as well).
So is it a JDK bug?


Hope somebody can help me.




This is my program :

*******

public static void serializeContainer(Container spanel,String fileName) throws IOException {

FileOutputStream fos = new FileOutputStream(fileName);

XMLEncoder encoder = new XMLEncoder(fos);

encoder.setExceptionListener(new ExceptionListener() {

public void exceptionThrown(Exception exception) {

exception.printStackTrace();

}

});



encoder.writeObject(spanel);

encoder.close();



}


******





And this is the printStackTrace :



******

java.lang.Exception: discarding statement JPanel0.add(JTextField0);


at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:333)


at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)


at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)


at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)


at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)


at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)


at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)


at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)


at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)


at java.beans.Encoder.writeObject(Encoder.java:55)


at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)


at java.beans.Encoder.writeExpression(Encoder.java:260)


at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)


at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)


at java.beans.Encoder.writeObject(Encoder.java:55)


at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)


at java.beans.Encoder.writeObject1(Encoder.java:192)


at java.beans.Encoder.cloneStatement(Encoder.java:205)


at java.beans.Encoder.writeStatement(Encoder.java:236)


at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)


at java.beans.DefaultPersistenceDelegate.invokeStatement(DefaultPersistenceDelegate.java:242)


at java.beans.java_awt_Container_PersistenceDelegate.initialize(MetaData.java:378)


at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)


at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)


at java.beans.javax_swing_JComponent_PersistenceDelegate.initialize(MetaData.java:565)


at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)


at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)


at java.beans.PersistenceDelegate.initialize(PersistenceDelegate.java:191)


at java.beans.DefaultPersistenceDelegate.initialize(DefaultPersistenceDelegate.java:393)


at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:103)


at java.beans.Encoder.writeObject(Encoder.java:55)


at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)


at java.beans.Encoder.writeExpression(Encoder.java:260)


at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)


at java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:100)


at java.beans.Encoder.writeObject(Encoder.java:55)


at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)


at java.beans.Encoder.writeObject1(Encoder.java:192)


at java.beans.Encoder.cloneStatement(Encoder.java:205)


at java.beans.Encoder.writeStatement(Encoder.java:236)


at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)


at java.beans.XMLEncoder.writeObject(XMLEncoder.java:253)


at coneco.workflow.painter.util.ObjectUtils.serializeContainer(ObjectUtils.java:91)


at coneco.workflow.painter.SerializeListener.actionPerformed(SerializeListener.java:90)


at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)


at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)


at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)


at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)


at javax.swing.AbstractButton.doClick(AbstractButton.java:289)


at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1092)


at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:932)


at java.awt.Component.processMouseEvent(Component.java:5021)


at java.awt.Component.processEvent(Component.java:4818)


at java.awt.Container.processEvent(Container.java:1380)


at java.awt.Component.dispatchEventImpl(Component.java:3526)


at java.awt.Container.dispatchEventImpl(Container.java:1437)


at java.awt.Component.dispatchEvent(Component.java:3367)


at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)


at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)


at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)


at java.awt.Container.dispatchEventImpl(Container.java:1423)


at java.awt.Window.dispatchEventImpl(Window.java:1566)


at java.awt.Component.dispatchEvent(Component.java:3367)


at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)


at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)


at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)


at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)


at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)


at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)


*************

   <<Less
About | Sitemap | Contact