wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JSplitPane divider won't rearrange components in FlowLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JSplitPane divider won Watch "JSplitPane divider won New topic
Author

JSplitPane divider won't rearrange components in FlowLayout

A Briarwood
Greenhorn

Joined: Apr 15, 2011
Posts: 6
Hello all,

I've got a JSplitPane with a left pane and a right. In the right pane I've got several components added to a JPanel using the default FlowLayout. If I resize the right edge of the JFrame using the mouse, the components in the FlowLayout rearrange themselves properly, but if I try to do the same thing using the divider, it doesn't allow me to "squish" the components and move them to the next line.

Is there a way to make the divider resize the right panel the way the edge of the frame does?

Here's a little self-contained example depicting the problem I'm having.

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

where w and h are the minimum width/height you want to allow.


luck, db
There are no new questions, but there may be new answers.
A Briarwood
Greenhorn

Joined: Apr 15, 2011
Posts: 6
Yes, that worked. Thanks.

But why does setting a minimum size affect whether or not the divider can resize the panel?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

To answer that I would need to go through a lot of the code of FlowLayout, and I don't really have the time for that right now. Why don't you try to find out for yourself? a good starting point might be the method minimumLayoutSize(Container target).
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2204
    
    7
Because thats the way the designers of the component decided the divider should work.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JSplitPane divider won't rearrange components in FlowLayout