Screenshot saving error JavaFX
<p>I am trying to save a screenshot of the current scene using javaFX.</p>

<pre><code>saveMenuItem.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
            @Override
            public void handle(ActionEvent t) {
                WritableImage image = scene.snapshot(new SnapshotParameters(), null);

                // TODO: probably use a file chooser here
                FileChooser fileChooser = new FileChooser();
                fileChooser.setTitle("Save Image");
                File file = fileChooser.showSaveDialog(primaryStage);
                if(file != null)
                {
                    try {
                        ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", file);
                    }
                    catch (IOException e) {
                        System.out.println("Couldn't Save.");

                    }
                }
            }  
        });
</code></pre>

<p>But my compiler NetBeans IDE 8.1 is giving an error:</p>

<pre><code>incompatible types: SnapshotParameters cannot be converted to Callback&lt;SnapshotResult, Void&gt;
</code></pre>

<p>Can someone tell me what I am doing wrong?</p>