• 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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!