Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2 questions: Swing and Serialization

0 views
Skip to first unread message

Costas Stratelos

unread,
Apr 10, 2003, 1:07:47 PM4/10/03
to
Hi,

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

Jim Sculley

unread,
Apr 10, 2003, 2:29:56 PM4/10/03
to

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.

0 new messages