Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Why does Swing JComponent class implement the interface Serializable? The way I've implemented my views, they are stateless, all the state data is stored in a Presentation Model. So I don't need to serialize my views. I've used a @SuppressWarnings("serial") annotation to remove the warnings. Are there better ways to remove them?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
161 views
Welcome To Ask or Share your Answers For Others

1 Answer

In the beginning GUI builders were going to save the UI in serialised format. The applet tag even has an attribute to load from serialised form (I don't know anyone else who has used that, and I've only used it to be malicious). Unfortunately using the serialisation mechanism for GUIs doesn't really work. Swing only guarantees compatibility in within the same major release (and I'm guessing even that has few tests).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...