This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 4523
    
    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: 4523
    
    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: 2152
    
    7
Because thats the way the designers of the component decided the divider should work.
 
Consider Paul's rocket mass heater.
 
subject: JSplitPane divider won't rearrange components in FlowLayout
 
Similar Threads
GridBagLayout resize issue
JSplitPanes not resizing when JFrame maximized
view before and after Tsunami
applyComponentOrientation: am i misunderstanding or something else...?
JSplitPane and its setDividerLocation method