I have a JSplitPane which contains two components. The component on the right side can be made visible or invisible at runtime depending on the user preference. I want to adjust the divider location correspondingly. I used resetToPreferredSizes() API thats makes the right component visible but when I make it invisible the splitbar still keeps showing. Can Anybody help me to do this? Puneet
I sounds like what you need to do is replace the JSplitPane with a JPanel holding the component on the left side of the split when the user changes their preferences. You could do this with CardLayout, or with simple add(), remove(), and validate().
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Jun 11, 2002
Hi Nate, Thanks for the reply but I actually need the JSplitPane so that I can resize the view at runtime of the two components. I want a feature of something like Visual Basic Editor where the Properties window can be made visible or invisible at runtime depending on user choice. Now when the component is made invisible I want the divider locaton to adjust automatically. I have used resetTopreferredSizes() but makes the visibility ok but when i made it invisible the divider keeps showing ... Any help will be heartly solicited Thanks Puneet