我正在尝试向我的JavaFX 2应用程序添加一个Icon,但我找到的方法似乎不起作用.
Image icon = new Image(getClass().getResourceAsStream("/images/icon.png"));
stage.getIcons().add(icon);
Run Code Online (Sandbox Code Playgroud)
图标大小为32x32.
当我尝试
Image icon = new Image("http://goo.gl/kYEQl");
Run Code Online (Sandbox Code Playgroud)
它在Netbeans和可运行的jar中都有效.
我希望这可以解决.