I've been looking for posts on why I get a null pointer
exception when I try to serialize a JFrame that has
a JMenuBar:
java.lang.NullPointerException
at javax.swing.plaf.basic.BasicGraphicsUtils.isLeftToRight(BasicGraphicsUtils.java:303)
at javax.swing.plaf.basic.BasicMenuItemUI.layoutMenuItem(BasicMenuItemUI.java:811)
at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredMenuItemSize(BasicMenuItemUI.java:387)
at javax.swing.plaf.basic.BasicMenuItemUI.getPreferredSize(BasicMenuItemUI.java:319)
<more stack trace here>
java.lang.NullPointerException
at javax.swing.BoxLayout.preferredLayoutSize(BoxLayout.java:245)
at javax.swing.plaf.basic.DefaultMenuLayout.preferredLayoutSize(DefaultMenuLayout.java:38)
<more stack trace here>
(so this is my first question, why??)
and I read some posts that hinted that serializing Swing components
is not recommended. So my second question is, why??? :-)
thanks
Costas
Serializing GUI components is a waste of time and disk space. Save only
the relevant bits of the model and any other pieces of state you want to
keep.
Jim S.