mattbdean
mattbdean

Reputation: 2552

Centering an Image within the ImageView?

My question is pretty simple. In the ImageView, the Image is on the top left. I want it to be in the center. Is there any way to do this?

NB: My question is not asking how to center the ImageView among it's parent, like this Android question, but centering the actual image within the ImageView.

Thanks in advance.

Upvotes: 1

Views: 71

Answers (1)

zhujik
zhujik

Reputation: 6574

There is no such thing as "the image is located on the topleft". A JavaFX ImageView has a property called viewport which defines what part of the image is visible. So you can't relocate the image itself - you have to redefine the view on it.

Upvotes: 1

Related Questions