2

This question might be relevant to this: java - How would I dynamically add swing component to gui on click?

But would it be possible to make the changes you did during runtime be permanent and see it again when you rerun the application?

I have some blurry ideas at the back of my mind but can you give me some suggestions on how this could work?

Community
  • 1
  • 1
chip
  • 3,039
  • 5
  • 35
  • 59

1 Answers1

2

This has little to do with Swing per se and all to do with persistence: What you are trying to do is set the state of an object (or group of objects) and have it persist when the program exits. There are several ways to do this including serialization, XML serialization (which I favor) using XML beans or JAXB, or properties. I suggest checking out JAXB and persisting your class's state with this by marshalling and unmarshalling the state to XML. Otherwise if you have a lot of information that must persist, then consider using a database.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • hey bro, thanks for the very useful information. i was thinking about serialization but it was a dead end for me there. you mentioned some technologies that are quite unfamiliar to me so I better start to do some learning! appreciate the help. :D – chip Jul 19 '12 at 03:54
  • 1
    @simon: Serialization would work too, and the other techniques that I mentioned hold no magic over serialization other than they produce human-readable files (a big advantage if serialization breaks for some reason). – Hovercraft Full Of Eels Jul 19 '12 at 04:07