Example usage for javafx.scene Node snapshot

List of usage examples for javafx.scene Node snapshot

Introduction

In this page you can find the example usage for javafx.scene Node snapshot.

Prototype

public WritableImage snapshot(SnapshotParameters params, WritableImage image) 

Source Link

Document

Takes a snapshot of this node and returns the rendered image when it is ready.

Usage

From source file:com.chart.SwingChart.java

/**
 * Copy to clipboard// w  w  w . jav  a 2s .  c  om
 * @param node JavaFX Node to copy
 */
public final void copyClipboard(final Node node) {

    WritableImage captura = node.snapshot(new SnapshotParameters(), null);

    ImageView iv = new ImageView(captura);

    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.put(DataFormat.IMAGE, captura);
    clipboard.setContent(content);

}