I have a Custom JPanel which I want to save state of. I am using XMLEncoder and XMLDecoder class to save and retrieve the state of my JPanel. However when i try to save the JPanel using writeObject method i get an exception
The reason I am using Java bean persistence is at some stage I am modifying the JPanel components such as adding a Jlabel with an icon etc. Now what I want is when the application is restarted these changes must be reflected. I tried Simple serialization but as i designed my JPanel using Netbeans and it is using GroupLayout so I got
The XML file that is generated after saving is as follows :
But the thing is My JPanel is very complex in that it consists of two JScrollPane and many other JPanel with as many as 100 buttons on them. Also the buttons have images which are not image files but images which are altered for our likings using MediaTracker. Also Since I want to do it fast so I thought I should go with the API I am aware of. I gone through the tutorial and am wondering how can it be applied to my situation. Can you provide me just a sample example for swing components using may be just JFrame and JPanel so that I can atleast understand how to proceed from then on.
Thanks and Regards, -- Girish --
Joined: Apr 24, 2008
Fine I have got it working using Preference API. Now what I want is when the software is uninstalled the Registry entries should be removed. Because now what is happening is even if the software is uninstalled and when it is installed again it comes up with the old JPanel... Is there Java specific way which can be used to accomplish the desired behavior or do i have to made changes in the Script?