java - JavaFX image nullpointerexception -
i'm trying declare image object, nullpointerexception every time try use it. constructor:
final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).tostring());
when try use in method, throws error. example...
sample.samplemethod(image);
any idea i'm doing wrong? i've tried 2 other ways:
image systemsecureimage = new image("images/notifications/systemsecure.png"); image systemsecureimage = new image("file://images/notifications/systemsecure.png");
the image
's constructor needs external form of resource path.
final image systemsecureimage = new image((getclass().getresource("images/notifications/systemsecure.png")).toexternalform());
Comments
Post a Comment