Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSplitPane Problem ...

 
Puneet Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
Puneet Gupta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant that you should replace the JSplitPane dynamically with a JPanel when the user selects to not show the other component.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic