This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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


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: 4989
    
    8

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: 4989
    
    8

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: 2372
    
    8
Because thats the way the designers of the component decided the divider should work.
 
Have you checked out Aspose?
 
subject: JSplitPane divider won't rearrange components in FlowLayout
 
It's not a secret anymore!