问题
Hello and thank you for your time. I am new to Netbeans and I am using the Netbeans 7.1 RC1 version of Netbeans. The problem I am running into is that I seem unable to add images to the project. I am designing a web app in JavaFX 2.0 and need a jpg picture for my background. I need to know how to add this picture to the Netbeans file system to be able to call it from my program. Any help is appreciated. Thanks again
回答1:
Easiest way is to put it directly into src folder, they you would be able to refer to it from your JavaFX application by next code:
ImageView iv = new ImageView(new Image(getClass().getResourceAsStream("/image.png")));
回答2:
ImageView iv = new ImageView(new Image(getClass().getResourceAsStream("/image.png")));
it is showing error Image is an abstract class not be instantiated so how we can immplement it help
来源:https://stackoverflow.com/questions/8435518/how-to-add-pictures-to-a-javafx-2-0-netbeans-project