Error saving image in an ImageView object with JavaFX and sceneBuilder

0

I'm making a simple graphical desktop application for image management and, I'm using JavaFX, in addition to its sceneBuilder. The idea is, by giving a button that a FileChooser appears, to choose the image and to show a new window with all the background image on it the problem is that by doing it gives me an error that I can not identify.
Edit: I have discovered that if I open the image in the same window there is no error, only when doing it in a new one.
This is my code.

Errors:

SceneBuilder:

    
asked by Danielmagox 17.11.2018 в 17:21
source

1 answer

0

For javafx avoid using the AWT tools (BufferedImage) There is a new class for it.

import javafx.scene.image.Image;

Image image1 = new Image("/flower.png", true);
Image image2 = new Image("my/res/flower.png", 100, 150, false, false);
Image image3 = new Image("http://sample.com/res/flower.png", 100, 0, false, false);
Image image4 = new Image("file:flower.png", 0, 100, false, false);

This can then be placed in an ImageView. My suggestion is that you review

javafx.scene.image.WritableImage
    
answered by 26.11.2018 в 01:07