I have a code like this:
Java FX Code:
   public void handle(MouseEvent event) {
        //if (event.getEventType() == MouseEvent.MOUSE_CLICKED) {
        if ( ( event.getEventType() == MouseEvent.MOUSE_PRESSED )&&
             (event.isPrimaryButtonDown()) ) {
                x1 = x2 = event.getX();
                y1 = y2 = event.getY();
                line = new BoundLine(pane, event, x1, y1,  x2, y2);
                pane.getChildren().add(line);                    
                //line.getEventDispatcher().dispatchEvent(event, null);
        }
   }
Is it possibile to propagate immediately the "MouseEvent event" to the javafx.scene.shape.Line (line in the code) object ? I have tried line.getEventDispatcher().dispatchEvent(event, null); but I've got this message error:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(BasicEventDispatcher.java:35) at testjavafxapplication.LinesEditCtx02$MouseHandler. handle(LinesEditCtx02.java:243) at testjavafxapplication.LinesEditCtx02$MouseHandler. handle(LinesEditCtx02.java:105) at com.sun.javafx.event.CompositeEventHandler.dispatc hBubblingEvent(CompositeEventHandler.java:69) at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(EventHandlerManager.java:217) at com.sun.javafx.event.EventHandlerManager.dispatchB ubblingEvent(EventHandlerManager.java:170) at com.sun.javafx.event.CompositeEventDispatcher.disp atchBubblingEvent(CompositeEventDispatcher.java:38 ) at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(BasicEventDispatcher.java:37) at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(EventDispatchChainImpl.java:92) at com.sun.javafx.event.BasicEventDispatcher.dispatch Event(BasicEventDispatcher.java:35) at com.sun.javafx.event.EventDispatchChainImpl.dispat chEvent(EventDispatchChainImpl.java:92) at com.sun.javafx.event.EventUtil.fireEventImpl(Event Util.java:53) at com.sun.javafx.event.EventUtil.fireEvent(EventUtil .java:33) at javafx.event.Event.fireEvent(Event.java:171) at javafx.scene.Scene$MouseHandler.process(Scene.java :3324) at javafx.scene.Scene$MouseHandler.process(Scene.java :3164) at javafx.scene.Scene$MouseHandler.access$1900(Scene. java:3119) at javafx.scene.Scene.impl_processMouseEvent(Scene.ja va:1559) at javafx.scene.Scene$ScenePeerListener.mouseEvent(Sc ene.java:2261) at com.sun.javafx.tk.quantum.GlassViewEventHandler.ha ndleMouseEvent(GlassViewEventHandler.java:228) at com.sun.glass.ui.View.handleMouseEvent(View.java:5 28) at com.sun.glass.ui.View.notifyMouse(View.java:922) at com.sun.glass.ui.gtk.GtkApplication._runLoop(Nativ e Method) at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApp lication.java:82) at java.lang.Thread.run(Thread.java:722)

Thanks in advance for your help.