• Post Reply Bookmark Topic Watch Topic
  • New Topic

serialization using XMLEncoder/XMLDecoder - problems for SpringLayout

 
toto litoto
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JDK 1.4.0 (obviously, as I have problems with XMLEncoder... )
What I need to do is create a JFrame with some Swing components inside
(JPanel's, JLabel's, etc.), to save it as an XML file and be able to restore
it later.
Everything went OK at the beginning, but there came the time to manage the
layout part. For various reasons, the most appropriate layout manager for my
application is SpringLayout.
The first step was again OK: when defining a SpringLayout for a panel, this
property was transferred to the XML by XMLEncoder and restored by
XMLDecoder.
But then, the happy days are over! In order for a SpringLayout to work, one
must obviously define lots of SpringLayout.Constraints, using Spring's. But
none of these things are transferred by XMLEncoder to the XML.
And, quite naturally, even if I modify manually the XML to include some
constraint info, the XMLDecoder won't read that info!
Does anybody know if there is any trick about this? Or is there a known bug
concerning the serialization of Spring's, and you know about a workaround?
Thanks a lot,
Adrian
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think this is a "bug"... Springs aren't serializable, so they don't specify how they should be written out...

I haven't played around with XMLEncoder or SpringLayout, so I'll have to look at it some more... but it looks pretty cool...

-Nate
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!