Search code examples
scalaspacescrollpane

How can I get rid of the extra space in a Scala Scrollpane table?


I am making a table in SCALA using the ScrollPane, by creating a Table and RowHeader inside of the scrollpane, which lets me give the user the ability to resize my column widths. However, when there isn't much in this table yet, I get a bunch of empty vertical space. Is there a way to get the ScrollPane to autosize itself to what is inside of it?


Solution

  • On JTable, method setFillsViewportHeight is defined - so you can get it on your scala Table, too:

    peer.setFillsViewportHeight(true)
    

    This would give you the effect you want.