How can we serialize a Frame, and how can we use that again?

 I need to serialize a frame and have to use again it. For that i serialized the frame, but while reading that frame from file, i am getting exception like javax.swing.AbstractButton$ButtonActionPropertyChangeListener; no valid constructor
        at java.beans.PropertyChangeSupport.writeObject(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(

 can you suggest me is there any mistake reading the frame from file.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mayank SAssociate Director - Product EngineeringCommented:
Why is it necessary for you to serialize the frame? The error is for some anonymous inner class defined inside the AbstractButton class. Looks like you serialized it using a different version of Java and are deserializing it using another - just a guess.
To be serializable, ALL classes need to have empty constructors

The inner class ButtonActionPropertyChangeListener does not have an empty constructor

Therefore you can't serialize it.

Try using the XMLEncoder to serialize it if you really need to

But you're probably better off just writing the data to the disk, and writing a method of reloading the data, rather than trying to serialize the UI components


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mayank SAssociate Director - Product EngineeringCommented:
Exactly, you need not serialize the whole frame itself. You can't make changes to the ButtonActionPropertyChangeListener class.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.