this is my first time asking a question on here but I have no where else to go, I've searched online but I can't seem to find an answer to my problem
I'm trying to simply load an image into an ImageView using javaFX on netbeans
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class ImageTest extends Application {
@Override
public void start(Stage primaryStage) {
Image image = new Image(getClass().getResourceAsStream("wall.jpg"));
ImageView iv = new ImageView(image);
Group root = new Group(iv);
Scene scene = new Scene(root, 300, 250, Color.WHITE);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
This code was my test run to see if that "wall.jpg" image would load in a different class, but no matter what I do it still throws an error. I've tried multiple other images but none seem to work. All the files are in the same folder with the code so I'm not quite sure whats going wrong here