如何在ImageView中獲取圖像以自動調整大小,使其始終適合父節點?調整圖像大小以適應父節點
這裏是一個小的代碼示例:
@Override
public void start(Stage stage) throws Exception {
BorderPane pane = new BorderPane();
ImageView img = new ImageView("http://...");
//didn't work for me:
//img.fitWidthProperty().bind(new SimpleDoubleProperty(stage.getWidth()));
pane.setCenter(img);
Scene scene = new Scene(pane);
stage.setScene(scene);
stage.show();
}
相關問題:([如何調整JavaFX中的窗口時,調整圖像大小] http://stackoverflow.com/questions/22993550/how-to-resize-an-image -when-resizing-window-in-javafx/22997981?noredirect = 1#36027997) – jewelsea