File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Question for the experts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Question for the experts" Watch "Question for the experts" New topic

Question for the experts

David Mace
Ranch Hand

Joined: May 26, 2004
Posts: 35
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,

Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis. -Jack Handy
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302


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.

GenRocket - Experts at Building Test Data
David Mace
Ranch Hand

Joined: May 26, 2004
Posts: 35
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,
I agree. Here's the link:
subject: Question for the experts
It's not a secret anymore!