Name: jl125535 Date: 04/29/2003
A DESCRIPTION OF THE REQUEST :
javax.swing.Spring and javax.swing.SpringLayout.Constraints should implement Serializable.
JUSTIFICATION :
What I need to do is create a JFrame with Swing components
inside (JPanel's, JLabel's, etc.), to save it as an XML file
and be able to restore it later. As of JDK 1.4, I use the
pair XMLEncoder/XMLDecoder to manage the serialization.
For various reasons, the most appropriate layout manager for
my application is SpringLayout. When defining a SpringLayout
as layout manager for a panel, this property was transferred
to the XML by XMLEncoder and restored by XMLDecoder (as the
class implements Serializable).
But then, the happy days are over! In order for a
SpringLayout to work, one must obviously define lots of
SpringLayout.Constraints, using Springs. 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!
The problem is that the two classes (i.e.,
javax.swing.Spring and javax.swing.SpringLayout.Constraints)
are not implementing Serializable.
CUSTOMER WORKAROUND :
Extend Spring and SpringLayout.Constraints in order to implement Serializable. (I have not confirmed this approach.)
(Review ID: 147206)
======================================================================