How to change Java Icon to an image icon?

Please follow the given steps to change the traditional java icon to an image icon of your choice.

1) Create a simple JavaFX project.
2) Create a folder with the name “images” in the source package.
3) Download any image using an icon and put it in the images folder in the source package that has been created in step 2.

 Smaple.jpg 

4) Now go start the method and type these lines.
                  Image icon = new Image(getClass().getResourceAsStream(“/images/Sample.JPG”);
                 stage.getIcon().add(icon);
                 stage.setScene(scene);
 

Now do clean and build and check the result. Thanks for reading.

 
 

Leave a Comment