Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ScrollPane increasing SplitPane left component

 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2619
9
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob!

I used the first solution.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic