File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JSplitPane and DividerLocation " Watch "JSplitPane and DividerLocation " New topic

JSplitPane and DividerLocation

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
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.
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.
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.

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

hope this'll solve ur problem
syed fazal faheem

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.
I agree. Here's the link:
subject: JSplitPane and DividerLocation
It's not a secret anymore!