wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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.
 
wood burning stoves
 
subject: JSplitPane Problem ...
 
Similar Threads
How to resize JFrame programmatically?
How to size a JSplitPane?
Problem in JDialogBox
JDialog sizing
JSplitPane resizing