Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Increase Table/scroll pane size corresponding to split pane

 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When i drag the divider from left to right, the left component is not increasing in its size and occupying the split pane. How to make it the component (jtable & scrollpane) to drag itself and go to the entire size of split pane.

sample code -
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After adding a component listener for scroll pane i was able to make the change. Actually scroll pane was increasing its size when the split pane increases, it was the table that did not increase its size automatically.

I have one question - why the propertylistener that listens for divider change prints 5 times when i move the divider once?

 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The scrollpane and component do occupy the entire left area when you drag the splitpane. However, as the column size the table is smaller, it gives you a illusion that it doesn't occupy the space. Do the following:
1) Drag the divider.
2) Then resize the column i.e increase the column size by dragging the header. You would see the horizontal scroll bar appear - which will show you that the scrollpane does occupy the entire space.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the column width was the one needed to be increased. But i took some time to figure out how to increase it - finally i have to set the min width, max width and then preferred width to actually increase the column width
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic