Change icon image JavaFX

余生颓废 提交于 2019-12-11 04:47:01

问题


How can I change the icon image of my JavaFX application?

And is possible to run my application without java installed on computer?


回答1:


stage.getIcons().add(new Image("yourImage.extension"));



回答2:


You can set the image of your primary stage

@Override
public void start(final Stage stage)
{    
   stage.getIcons().add(new Image("icon.png"));
}

And yes you can run your application on a system without the run-time, for this you must have the run-time embedded in your application




回答3:


In regards to your second question, I know this exists, but I never used it. That would be a self contained app. Check this site:

http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm



来源:https://stackoverflow.com/questions/21690249/change-icon-image-javafx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!