Answer the question
In order to leave comments, you need to log in
How to center View in ViewImage?
Kind
The problem is probably simple, but even I don’t know how to ask a question to Google.
I have an imageView, I add a picture to it. it is aligned to the top left, i need it to be centered
like this in fxml
<ImageView fx:id="imageView" fitHeight="200" fitWidth="200"
pickOnBounds="true"
preserveRatio="true"/>
public class ImageDownloadLayoutController implements Initializable {
@FXML
ImageView imageView;
@FXML
Button addImage, downloadImage;
@Override
public void initialize(URL location, ResourceBundle resources) {
File file = new File("src/test/1.jpg");
Image image = new Image(file.toURI().toString());
imageView.setImage(image);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question