Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved How To Load An Image From Resources

Joined
Apr 19, 2016
Messages
55
I have an imageView in a '.FXML' file and I want to provide it an image. Is there a way to do it manually, in SceneBuilder? If not, how would I do it using the Resources class? I have tried using the following but without luck:
Code:
Resources.getAsBufferedImage(SOME_IMAGE_STR)
 
Client Developer
Joined
Oct 12, 2015
Messages
3,760
@FXML
private ImageView img;

....

//In your initialise
Image image = new Image(Resources.getAsStream("path to your image"));
img.setImage(image);


^^ From memory, feel free to correct me @Savior
 
Also, you should join the developer Slack chat, you're likely to get a quicker answer.

Slack
 
Top