When I create Swing apps for remote users, I just create jar files and create a WebStart file to let users download the app and then run it. I haven't heard of application servers serving up JFrames, etc, like JSPs. Was that the original intent?
Serialization in Java allows us to convert an Object to stream that we can send over the network or save it as file or store in DB for later usage. Deserialization is the process of converting Object stream to actual Java Object to be used in our program.
Serialization is simply turning an existing object into a byte array. This byte array represents the class of the object, the version of the object, and the internal state of the object. This byte array can then be used between JVM's running the same code to transmit/read the object.
Serializable is one of the few marker interfaces found in core Java. Marker interfaces are special case interfaces with no methods or constants. Object serialization is the process of converting Java objects into byte streams. We can then transfer these byte streams over the wire or store them in persistent memory.
Serializable is a marker interface (has no data member and method). It is used to "mark" Java classes so that the objects of these classes may get a certain capability. The Cloneable and Remote are also marker interfaces. The Serializable interface must be implemented by the class whose object needs to be persisted.
If you want to have nothing other than the UI you could persist it to disk and then restore it the next time the program is run.
It'd come back up with everything exactly as you left it.
No fancy stuff required.
I've actually used it in the past. Build a compiler that takes in XML data, configures and builds your display objects up, serialize them and then pass them on to a thin client that doesn't know anything beyond UI and simple callbacks.
Of course it turned out to be terribly inefficient. We wound up seperating the data into a different class and using an instance of that as a parameter for our display object constructors.
There's no good reason I can think of to have the swing objects themselves serializable, except for ease of use. In fact it turned out to be a little dangerous, since we thought "if they made it serializable in the first place, then it can't be that bad an idea."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With