• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question for the experts

 
David Mace
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all you experts, I have but one question. I've searched high and low for the answer to this question, but haven't been able to fashion up any solution.

I have a JFrame split by 2 JSplitPanes into 3 sections. The leftmost panel is to be used as a navigation menu for the other 2 panels. Now my problem is this: I would like to be able to "freeze" the JSplitPane so that it does not resize and overtake the majority of the window. I have already set resizeWeights, but this does not ensure that I'm not going over the amount of space I would like to allocate.

Is there any way to keep the pane from resizing? I'll bow down to the first person that can answer this question because I'm pulling my hairs out one by one.

Thanks in advance,
David
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
split.setEnabled(false)

I'll bow down to the first person that can answer this question

So many quotes in my head for this one.

You bow to noone - King Aragorn LOTR ROTK

Kneal before Zod - Superman II

Anyway, that should disable the user from being able to click and drag the Splitpane one direction or another. However, that may not resolve the issue of the initial position of the JSplitPane when using Layout Managers. But there are methods for initially specifying a position of the splits.

setDividerLocation(int) will set the location of the divider relative to it's xy cooridanate.
 
David Mace
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. It wasn't an issue of keeping a user from resizing the panes, but rather the panes becoming larger because of more components or text being added. I found that by setting the preferredSize of the panels to be equal to the .getWidth() and .getHeight() when the JFrame was initially created, that I'm able to keep them from resizing at a later time.

Thanks again,
David
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic