Java Code Examples for javafx.scene.input.ClipboardContent#putImage()

The following examples show how to use javafx.scene.input.ClipboardContent#putImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Screenshot.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * Save screenshot to clipbaord
 */
public void screenshotToClipboard() {
    Image image = getScreenshot();
    Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putImage(image);
    clipboard.setContent(content);
    LOGGER.atInfo().log("Copied screenshot to clipboard");
}
 
Example 2
Source File: PasteboardImpl.java    From oim-fx with MIT License 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void writeImage(WCImageFrame wcImage) {
	Object platformImage = WCGraphicsManager.getGraphicsManager().toPlatformImage(wcImage.getFrame());
	Image fxImage = Image.impl_fromPlatformImage(platformImage);
	ClipboardContent content = new ClipboardContent();
	content.putImage(fxImage);
	clipboard.setContent(content);
}
 
Example 3
Source File: EditorFrame.java    From JetUML with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Copies the current image to the clipboard.
 */
public void copyToClipboard() 
{
	DiagramTab frame = getSelectedDiagramTab();
	final Image image = ImageCreator.createImage(frame.getDiagram());
	final Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putImage(image);
    clipboard.setContent(content);
	Alert alert = new Alert(AlertType.INFORMATION, RESOURCES.getString("dialog.to_clipboard.message"), ButtonType.OK);
	alert.initOwner(aMainStage);
	alert.setHeaderText(RESOURCES.getString("dialog.to_clipboard.title"));
	alert.showAndWait();
}
 
Example 4
Source File: JFreeChartUtils.java    From old-mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public static void exportToClipboard(ChartViewer chartNode) {
  final Clipboard clipboard = Clipboard.getSystemClipboard();
  final ClipboardContent content = new ClipboardContent();
  final int width = (int) chartNode.getWidth();
  final int height = (int) chartNode.getHeight();
  WritableImage img = new WritableImage(width, height);
  SnapshotParameters params = new SnapshotParameters();
  chartNode.snapshot(params, img);
  content.putImage(img);
  clipboard.setContent(content);
}