I'm trying to add an Icon to my JavaFX 2 application, but the ways I have found don't seem to work.
Image icon = new Image(getClass().getResourceAsStream("/images/icon.png"));
stage.getIcons().add(icon);
The icon is 32x32 in size.
When I try
Image icon = new Image("http://goo.gl/kYEQl");
It does work, in Netbeans and in the runnable jar.
I hope this can be fixed.
The problem was in the icon itself. It did load it like it should, but for some reason it didn't display like it should.
I remade the icon I was trying to use to different sizes (16x16 up to 512x512) and added them all to the icon list.
Now it uses the icon like it should.