• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

serialization using XMLEncoder/XMLDecoder - problems for SpringLayout

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
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,
Posts: 4121
IntelliJ IDE Spring Java
  • 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...

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