Skip to main content

JSplitPane & CardPanel

No replies
Joined: 2003-06-12
Points: 0

Hi All,

I'd like some help with the following:

I have a JSplitPane whose left component is a JPanel
and right component is a JPanel with a BoxLayout Y-Axis
and which in turn contains a JPanel and a CardPanel
stacked along the Y-Axis. The CardPanel I'm referring to
is the one available at the The Swing Connection at the
Sun site.

When I launch my app., the CardPanel has a single card
which shows up nicely. However, when I dynamically
add a new JPanel to the CardPanel and whose size is larger
than the previous cards in the CardPanel, the JSplitPane
doesn't resize fully to display the new card.

The questions I have are:
1. The CardPanel does indeed invoke the methods
revalidate() and repaint() which I assume would
propagate up the hierarchy and upto the JSplitPane
in my case. Are these methods sufficient (enough) ?

2. Is it possible at all for the JSplitPane to
automatically resize its left/right components
when these components are dynamically added ?
Or, do I need to invoke any other method ?

Thanks for any help. I do have similar problems when
I use a CardPanel in a JDialog.