Asi jsi blbe hledal, v dokumentaci je tohle:
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class AA extends Application {
@Override public void start(Stage stage) {
Image image = new Image("buce.jpg");
ImageView imageView = new ImageView();
imageView.setImage(image);
imageView.setFitHeight(300);
imageView.setPreserveRatio(true);
imageView.setSmooth(true);
imageView.setCache(true);
Group root = new Group();
Scene scene = new Scene(root);
scene.setFill(Color.BLACK);
HBox box = new HBox();
box.getChildren().add(imageView);
root.getChildren().add(box);
stage.setTitle("ImageView");
stage.setWidth(800);
stage.setHeight(600);
stage.setScene(scene);
stage.sizeToScene();
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
...a to samozrejme funguje.