This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Have a MenuItem trigger a Filechooser to choose an Image to put in an ImageViewer

 
John Jeffersonian
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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.

MainApp.java


MyImage.java (a model image class to hold properties):


RootController.java


ImageViewerController.java


Error Messages:


 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!