Invalid URL or resource not found image javafx maven

44 Views Asked by At

[I'm using using the controlfx 11.2.0 library to display notifications when the user logs in, i'm trying to add an image to the notification, but says that the route is invalid or not found.]. link to see an image of my whole code: https://es.stackoverflow.com/questions/611372/invalid-url-or-resource-not-found-imagen-javafx-maven

i placed the paths similarly to how Scene Builder does it, however using this and others did not work. how should i place them?

edit: My question was answered in the previous link.

public void error(){

    Notifications notifications = Notifications.create();
    notifications.title("Login Error");
    notifications.text("Username or Password incorrect");
    Image image = new Image("@src/main/resources/com/example/pokedb/images/cancelar.png");
    notifications.graphic(new ImageView(new Image(Objects.requireNonNull(getClass().getResourceAsStream("com/example/pokedb/images/cancelar.png")))));
    notifications.hideAfter(Duration.seconds(5));
    notifications.position(Pos.BASELINE_CENTER);
    notifications.show();
}
0

There are 0 best solutions below