Java FX打印图像的GridPane

时间:2019-01-12 17:35:27

标签: java image javafx

嗨,我目前在修补错误时遇到了一些问题。 我无法打印多个图像,也不知道为什么。 我要累了,你们有个主意,这个错误可能从哪里来?

        Group root = new Group();
    printChoicesOfDominosScene = new Scene(root, 900, 900, Color.WHITE);

    // Time to load our image

    GridPane dominoChoice = new GridPane();
    dominoChoice.setPadding(new Insets(50,50,50,50));
    dominoChoice.setHgap(20);
    dominoChoice.setVgap(20);

    int imageCol = 1;
    int imageRow = 1;
    int i = 0;

    //       for (int i = 0; i < 5; i++) {
    if (dominosFilesNameAvailable != null && dominosFilesNameAvailable[i] != null) {
        ImageView imv = new ImageView();
        Image image = new Image(new FileInputStream(dominosFilesNameAvailable[i]), 800, 800, true, true);
        imv.setImage(image);

        imv.setOnMouseClicked(event -> {
            chosenDomino();
        });

        HBox pictureRegion = new HBox();
        pictureRegion.getChildren().add(imv);
        dominoChoice.add(pictureRegion, imageCol, imageRow);
        root.getChildren().add(dominoChoice);
    }
    //      }

    // Initialise Elements



    askPlayerNameScene = new Scene(grid, 500, 200);
    window.setScene(askNumberPlayerScene);
    window.show();


}

0 个答案:

没有答案