Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JSplitPane and component minimum sizes

Posted on 2004-09-02
8
Medium Priority
?
934 Views
Last Modified: 2008-03-10
Hi,

I notice that when you have a JSplitPane, it restricts its divider adjustment to obey the minimum sizes of the components in the panels of its left and right sides.
However if I dynamically change whats in these panels the divider remains where it was, and if the panel is now too cluttered the min sizes are no longer being obeyed .... However! if you now click on the divider it automatically jumps to a position to "re-obey" the minimum sizes.

My question - can i get this to happen automatically when i add components to one of the panels or on a window is resize event??
0
Comment
Question by:cathalmchale
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11961902
try calling revalidate() on the split pane after changing the panel layout.
0
 

Author Comment

by:cathalmchale
ID: 11961903
Also i would like a bit of space between the left panel -> the divider -> the right panel.  how do i do this??
0
 
LVL 18

Expert Comment

by:armoghan
ID: 11961914
To make space use setDividerSize();
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cathalmchale
ID: 11961916
tried calling revalidate()  it didnt work. I will check back later, thanks
0
 

Author Comment

by:cathalmchale
ID: 11997237
Hi again,

>>To make space use setDividerSize();
this doesnt really do what i want - i would like some space around the perimeters of the left and right panels.

also any further ideas on my original question
>>My question - can i get this to happen automatically when i add components to one of the panels or on a window is resize event??
0
 

Author Comment

by:cathalmchale
ID: 12028458
???
0
 
LVL 37

Accepted Solution

by:
zzynx earned 200 total points
ID: 12065794
>>My question - can i get this to happen automatically when i add components to one of the panels or on a window is resize event??

JSplitPane.setDividerLocation
         public void setDividerLocation(double proportionalLocation)

Sets the divider location as a percentage of the JSplitPane's size.
This method is implemented in terms of setDividerLocation(int). This method immediately changes the size of the split pane based on its current size. If the split pane is not correctly realized and on screen, this method will have no effect (new divider location will become (current size * proportionalLocation) which is 0).

Parameters:
proportionalLocation - a double-precision floating point value that specifies a percentage, from zero (top/left) to 1.0 (bottom/right)


>>Also i would like a bit of space between the left panel -> the divider -> the right panel.  how do i do this??
Give your left and right panels an empty border. You can specify the top,left, bottom and right spaces

E.g.
leftPanel.setBorder( new EmptyBorder(0, 0, 0, 10) );  // add extra space only on the right of this left panel
rightPanel.setBorder( new EmptyBorder(0, 10, 0, 0) ); // add extra space only on the left of this right panel

0
 
LVL 37

Expert Comment

by:zzynx
ID: 12066302
Thanks for accepting

I saw this one was already open some time...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question