Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7913665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:53:52+00:00 2026-06-03T13:53:52+00:00

I am trying to serialize a JFrame containing a JDesktopPane with several JInternalFrames. I

  • 0

I am trying to serialize a JFrame containing a JDesktopPane with several JInternalFrames.
I encountered a problem with the LookAndFeel because for any reason it is not possible to serialize a Swing component with a to the CrossPlatform LnF different one.
So I wrote this test program in order to figure out my possibilites:

public static void main(String[] args) {    
    try {
        JFrame f = new JFrame();
        f.setBounds(200,200,200,200);
        JTree tree = new JTree();
        f.add(tree);
        f.setVisible(true);

        UIManager.setLookAndFeel(
                   UIManager.getCrossPlatformLookAndFeelClassName());
        SwingUtilities.updateComponentTreeUI(f);

        ObjectOutputStream oop = new ObjectOutputStream(
                   new FileOutputStream(new File("test.serialized")));
        oop.writeObject(f);
    } catch(IOException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (UnsupportedLookAndFeelException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

This didn’t work for two reasons:

  1. I am not able to serialize the frame and the contained tree. Just the tree is fine but just when
  2. I set the LookAndFeel to cross platform in the first place and create my tree afterwards.

Any idea how to fix this?

EDIT:
Sorry for making this not clear:
I am NOT trying to serialize the LnF or something like that.
The LnF doesnt want me to serialize the Frame.

java.io.NotSerializableException: com.apple.laf.AquaTreeUI

And on top of that i am not able to serialize a Frame that contains a Tree.

Exception in thread "AWT-EventQueue-0" java.lang.InternalError: incorrect component
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:53:53+00:00Added an answer on June 3, 2026 at 1:53 pm

    Check this. Is the implementation proposed by @SoboLAN.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to serialize a ItemTransaction and protobuf-net (r282) is having a problem.
When I'm trying serialize a class containing this property: [NonSerialized] property System::Collections::ObjectModel::ReadOnlyCollection<String^>^ IgnoredWords I
I had an odd problem today when I was trying to serialize an object.
I am trying to serialize a class several of the data-members are Nullable objects,
I'm trying to serialize a querystring to JSON in C#. I'm not getting the
I'm trying to serialize an object to XML that has a number of properties,
I'm trying to serialize some objects obtained from a 3rd Party .NET Lib to
I have been trying to serialize a pretty big object. This object uses dictionaries
i'm trying to serialize DataTable to Json or XML. is it possibly and how?
I am trying to serialize a large (~10**6 rows, each with ~20 values) list,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.