Why is Java Swing serializable?

前端 未结 2 1382
天命终不由人
天命终不由人 2021-01-18 01:48

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

2条回答
  •  余生分开走
    2021-01-18 02:02

    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."

提交回复
热议问题