Q:

Event Handling for Pie Chart

I have created a javafx pie chart and want to do something when the user clicks on a slice of the pie.  I am following this tutorial:
for (final PieChart. Data data : chart.getData()) {
data.getNode().addEventHandler(MouseEvent. MOUSE_PRESSED,
    new EventHandler<MouseEvent>() {
        @Override public void handle(MouseEvent e) {
            caption.setTranslateX(e.getSceneX());
            caption.setTranslateY(e.getSceneY());
            caption.setText(String.valueOf(data.getPieValue()) + "%");
         }
    });

I am getting these error warnings prior to compile:
On the ".addEventHandler"
Bound mismatch: The generic method addEventHandler(EventType<T>, EventHandler<? 
superT>) of   type Node is not applicable for the arguments (Integer, new
EventHandler<MouseEvent>  (){}).  The inferred type MouseEvent&Event is not a valid 
substitute for the bounded parameter <T extends Event>

On the "EventHandler"
Bound mismatch: The type MouseEvent is not a valid substitute for the bounded parameter  
<T extends Event> of the type EventHandler<T>

Does anyone have any insights into why I am getting these errors? 

A:

The addEventHandler() method takes two parameters: one of type T, and one that has a super class T. You gave it an EventHandler and an Integer.  Since Integer is not a super class of EventHandler, you get an exception. 
My guess is that you're accidentally using Java SE's MouseEvent instead of Java FX's MouseEvent.