• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
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:


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!