This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JSplitPane and DividerLocation 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 and DividerLocation " Watch "JSplitPane and DividerLocation " New topic
Author

JSplitPane and DividerLocation

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I am just trying to create a SplitPane From JSplitPane and I want to set the DividerLocation first as
splitpane.setDividerLocation(0.5);
Then I want the Movable divider, But I am not able get that. Everytime my divider is at the left most position(I have taken the Horizontal Split. I don,t want to put any component on the splitPane initailly.
Can any one Help me.I urgrntly need it, This is very important for me.
Thanks a lot.
Kumud
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
hi kumud,
the problem is that u r using floating point value as the parameter. instead use some int between 0 and 750.
setDividerLocation(350);
coz the parameter which is passed represents the position in terms of pixels. so untill unless u'll use reasonably big value ur divider will remain at left sde only.
setDividerLocation

------------------------------------------------
public void setDividerLocation(int location)
Sets the location of the divider. This is passed off to the look and feel implementation.
Parameters:
location - an int specifying a UI-specific value (typically a pixel count)
------------------------------------------------

hope this'll solve ur problem
regards
deekasha
syed fazal faheem
Greenhorn

Joined: Jul 13, 2001
Posts: 12
Hi there,
I got a similar problem, I have to hide the right part of the split pane. I am having the split pane in a dialog. My dialog size is 500,300. But if i set the divider location to 450 or 500, the divider gets positioned to the left hiding the left part of the pane.But it works fine for 400. But 100 pixels of space is visible at the right. I need to avoid this.
Please help me.
Thanks in advance.
fazal
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSplitPane and DividerLocation