#Trouble with changing stage icons

4 messages · Page 1 of 1 (latest)

bitter tinsel
#
Image icon = new Image("duck.png");
        stage.getIcons().add(icon);

That's what Im doing to change the icon of the stage but I'm getting this error:

Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found
    at javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1123)
    ... 8 more
Exception running application main.NewFXMain

Not sure what I'm doing wrong with the url.

random kilnBOT
#

This post has been reserved for your question.

Hey @bitter tinsel! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

distant hill
#

I believe you should put the image in root of project