-1

I want to make a GridView resize itself to a value big enough to fit the height of its content so no scrollbar is needed (I want the gridbar together with other nodes in a scrollbar, see image).

GridView in Scrollbar

But there isn't any possibility to get at least the number of rows to calculate the needed height.

  • Will a [`FlowPane`](https://docs.oracle.com/javase/8/javafx/api/javafx/scene/layout/FlowPane.html) work? – SedJ601 Aug 23 '17 at 18:56
  • I want to use the feature of binding a model class to the GridView, what would be a problem if I use a FlowPane (not sure about that). – A. Glogger Aug 24 '17 at 15:19

1 Answers1

0

If you do not set any height value, the default behaviour is to fit the content. Or you could do this:

gridView.setPrefHeight(Region.USE_COMPUTED_SIZE);
Marcelo Li Koga
  • 456
  • 1
  • 3
  • 13
  • I can retrace this behavior on initialization of the GridView. But if I resize the window the GridView height keeps as before and a scrollBar appears. – A. Glogger Aug 24 '17 at 15:17
  • I do not understand what is the behavior that you are describing. If you resize the window to a smaller size, what behavior do you expect? – Marcelo Li Koga Aug 24 '17 at 16:22
  • I want the size (height) of the GridView to grow up so that the scrollPane of the GridView doesn't show up. – A. Glogger Aug 24 '17 at 17:19