This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes ScrollPane increasing SplitPane left component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "ScrollPane increasing SplitPane left component" Watch "ScrollPane increasing SplitPane left component" New topic
Author

ScrollPane increasing SplitPane left component

John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Hi,
I am trying to add a Scroll Pane in the left component of a SplitPane. The scroll pane encloses a JTable. I set the resize weight of the split pane as 0.35. So the left pane should contain only 35% of the SplitPane's width. But after adding the scroll pane it takes around 70% from the left. My code below. I even tried calling JSplitPane.resetToPreferredSizes() which did not resolve the issue
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2154
    
    7

The above method will only work once the GUI is visible.

You have (at least) two solutions:

1) hardcode the pixel value instead of the percentage:



2) Add the code to the end of the EDT so it executes after the GUI is visible:

John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Thanks Rob!

I used the first solution.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ScrollPane increasing SplitPane left component
 
Similar Threads
jtable
JTable
Change Table and Tree color when selected (vice versa)
Problem with JTable when no. of records are more than the size of frame!!!
JTable