I have a GridPane
and in all of the cells ImageView
containing Images. I successfully managed to make the GridPane
resizable when I change the window size.
The problem is that when the GridPane
gets bigger the images won't grow.
I know you can make them fit when it's in full-screen by:
imageView.setFitHeight(100);
imageView.setFitWidth(100);
With this code, the images will be too big when not in full-screen.
I want to have them in Window Mode fit perfectly(Fit(80))
in the cell, as well as in Fullscreen(Fit(100))
.
My (not so good-looking) idea was to have a method something like:
if(stage.inFullscreen) { setFitHeight/Width(100)};
if(stage.inWindowscreen) { setFitHeight/Width(80)};
Is there any other more elegant way?
Part of my Code:
<GridPane fx:id="Board" layoutY="-1.0" prefHeight="800.0" prefWidth="836.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
...