Have a MenuItem trigger a Filechooser to choose an Image to put in an ImageViewer
posted 1 year ago
I want to have a MenuItem trigger a Filechooser to choose an Image to put in an ImageViewer, but for some reason the ImageViewer parent view (which is seperate from the root view and is inside the root view) controller initializer keeps throwing a NullPointerException on a addListener statement that I want to use for the ImageViewer to change the Image automatically when the currentImage changes (i.e. when the user chooses a new Image through the MenuItem). It's driving me mad, I'm new to JavaFX, so please be gentle to my stupidity. I won't post my FXMLs as I'm 100% adamant I've binded everything inside SceneBuilder correctly.
Below is my source code, in ImageViewerController.java I've commented to the right of the line that throws the NullPointerException.
MyImage.java (a model image class to hold properties):