JavaFX Application Icon

后端 未结 17 1722
滥情空心
滥情空心 2020-11-28 02:25

Is it possible to change the application icon using JavaFX, or does it have to be done using Swing?

17条回答
  •  囚心锁ツ
    2020-11-28 02:48

    Another easy way to insert your own icon on the title bar in JavaFX is to add the image to your primary stage using the following method:

    Image ico = new Image("resources/images/iconLogo.png");
    stage.getIcons().add(ico);
    

    Make sure your import javafx.scene.image.Image (if using an ide like netbeans this should be automatically done for you).

提交回复
热议问题