title: JavaFX Adding a MouseEvent to a bar inside of a BarChart
body: <p>So i am trying to create an application that has values on a chart, which shows normally. However i am also trying to add a mouse event that is called when i click on a particular bar of the bar graph. More specifically it updates a status bar with some more detail pulled from the database.</p>
  
  <pre><code>Group root = new Group();
  String[] years = {"Opened", "Closed", "Still Opened"};
  CategoryAxis xAxis = new CategoryAxis();
  xAxis.setCategories(FXCollections.observableArrayList(years));
  NumberAxis yAxis = new NumberAxis("Jobs", 0.0d, 1, .2);
  BarChart.Series&lt;String, ObservableList&gt; s1 = new BarChart.Series("51 ",                                        FXCollections.observableArrayList(
                  new BarChart.Data(years[0], Math.random()),
                  new BarChart.Data(years[1], Math.random()),
                  new BarChart.Data(years[2], Math.random())));;
  
          BarChart.Series&lt;String, ObservableList&gt; s2 = new BarChart.Series("52 ", FXCollections.observableArrayList(
                  new BarChart.Data(years[0], Math.random()),
                  new BarChart.Data(years[1], Math.random()),
                  new BarChart.Data(years[2], Math.random())));
  
          BarChart.Series&lt;String, ObservableList&gt; s3 = new BarChart.Series("53 ", FXCollections.observableArrayList(
                  new BarChart.Data(years[0], Math.random()),
                  new BarChart.Data(years[1], Math.random()),
                  new BarChart.Data(years[2], Math.random())));
  
          BarChart.Series&lt;String, ObservableList&gt; s4 = new BarChart.Series("54 ", FXCollections.observableArrayList(
                  new BarChart.Data(years[0], Math.random()),
                  new BarChart.Data(years[1], Math.random()),
                  new BarChart.Data(years[2], Math.random())));
  
          ObservableList barChartData = FXCollections.observableArrayList(s1,s2,s3,s4);
  
          this.statusMessage.setText("Setting listener");
          for (XYChart.Data&lt;String, ObservableList&gt; dt : s1.getData()) 
          { 
              statusMessage.setText("Acting on: " + dt.getXValue());
              dt.getNode().setOnMouseClicked((MouseEvent event) -&gt; {
                  statusMessage.setText("Clicked");
              }); 
          }
  
          BarChart chart = new BarChart(xAxis, yAxis, barChartData, 25.0d);
  </code></pre>
  
  <p>this application will compile with and without the event, but with the event when i create the chart it fails and is unable to show it. I assume its because the event is not being loaded to the bar</p>
  
  <p>The errors i get:</p>
  
  <pre>
  Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1768)
      at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1651)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
      at javafx.event.Event.fireEvent(Event.java:204)
      at javafx.scene.Node.fireEvent(Node.java:8175)
      at javafx.scene.control.Button.fire(Button.java:185)
      at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
      at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
      at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
      at javafx.event.Event.fireEvent(Event.java:204)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3746)
      at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3471)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1695)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2486)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:314)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:243)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:345)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:526)
      at com.sun.glass.ui.View.notifyMouse(View.java:898)
  </pre>