Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JXTable width to adjust according to content

 
Rico Strydom
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JXTable that is created like this:



The problem is that when it gets filled, all the columns are squashed together to fit into the jxtable. I expected the columns to be adjusted according to the width of the column header or column value (which ever is wider) and then for a horizontal scroll bar to be displayed that will enable me to scroll left or right.
How do I go about to bridge this problem?
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try calling setHorizontalScrollEnabled(true). According to the API:
enabled - If true, the scrollpane will allow the table to scroll horizontally, and columns will resize to their preferred width. If false, columns will resize to fit the viewport.
 
Campbell Ritchie
Marshal
Posts: 52632
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and welcome to the Ranch
 
Rico Strydom
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys. Yes, the setHorizontalScrollEnabled(true) did the trick.
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!