This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes JSplitPane Problem ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JSplitPane Problem ..." Watch "JSplitPane Problem ..." New topic
Author

JSplitPane Problem ...

Puneet Gupta
Greenhorn

Joined: Jun 11, 2002
Posts: 6
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
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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().


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Puneet Gupta
Greenhorn

Joined: Jun 11, 2002
Posts: 6
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
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I meant that you should replace the JSplitPane dynamically with a JPanel when the user selects to not show the other component.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSplitPane Problem ...