mercredi 20 juillet 2016

Javafx Label creation results in NullPointerException

I'm trying to build my first Javafx project on Netbeans, and i'ven been stuck at adding an imageview for a Label, it always returns a null exception. And now that i understand that it's because it cant locate my image i'm assuming it's because im giving the program an incorrect path..

    Image image = new Image(getClass().getResource("Data/Images/Logo.jpg").toExternalForm());
    Label logoLabel = new Label("Logo", new ImageView(image));

I'm trying to get an image saved on the JavaFX programs's Directory/Data/Images/Logo.jpg How do i go about reaching that location?

Aucun commentaire:

Enregistrer un commentaire