0

i have an scene with 1024 width in 600 height and i have an image with this size 1800x1022 i add this image to ImageView and call setFitWith & Height to scale it with my scene . but i want if some One click on maximize button the imageVew scale to new size.Any Idea?

1 Answers1

1

You could attach a handler to the width and height properties of the scene so that anytime a user changes the size of the image (whether it be maximizing or dragging the window to resize it), you can resize the image dynamically:

stage.widthProperty().addListener(new ChangeListener() {@
    Override
    public void changed(ObservableValue ov, Object oldValue, Object newValue) {
        //do some meaningful stuff here, 
    }
});

And then do your re-sizing of the image inside that.

Arman H
  • 5,488
  • 10
  • 51
  • 76
WillBD
  • 1,919
  • 1
  • 18
  • 26