當前位置: 首頁>>代碼示例>>Java>>正文


Java ClipboardContent.putImage方法代碼示例

本文整理匯總了Java中javafx.scene.input.ClipboardContent.putImage方法的典型用法代碼示例。如果您正苦於以下問題:Java ClipboardContent.putImage方法的具體用法?Java ClipboardContent.putImage怎麽用?Java ClipboardContent.putImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.input.ClipboardContent的用法示例。


在下文中一共展示了ClipboardContent.putImage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handle

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@Override
public void handle(final MouseEvent event) {
    final Pane pane = (Pane) event.getSource();
    final ImageView view = (ImageView) pane.getChildren().get(0);
    final Dragboard db = view.startDragAndDrop(TransferMode.COPY);
    final ClipboardContent content = new ClipboardContent();
    content.putString(view.getId());
    final ComponentPane componentPane = loadComponent(pane.getChildren().get(0).getId().toLowerCase());
    workspace.getChildren().add(componentPane);
    componentPane.applyCss();
    final WritableImage w  = componentPane.snapshot(null,null);
    workspace.getChildren().remove(componentPane);
    content.putImage(w);
    db.setContent(content);
    event.consume();
}
 
開發者ID:StephaneMangin,項目名稱:Synth,代碼行數:17,代碼來源:CoreController.java

示例2: editCopyImageMenu_onAction

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@FXML
void editCopyImageMenu_onAction(ActionEvent event) {
	Clipboard clipboard = Clipboard.getSystemClipboard();
	ClipboardContent content = new ClipboardContent();

	// for paste as file, e.g. in Windows Explorer
	try {
		File tempTokenFile = fileSaveUtil.getTempFileName(false, useFileNumberingCheckbox.isSelected(),
				fileNameTextField.getText(), fileNameSuffixTextField);

		writeTokenImage(tempTokenFile);
		content.putFiles(java.util.Collections.singletonList(tempTokenFile));
		tempTokenFile.deleteOnExit();
	} catch (Exception e) {
		log.error(e);
	}

	// for paste as image, e.g. in GIMP
	content.putImage(tokenImageView.getImage());

	// Finally, put contents on clip board
	clipboard.setContent(content);
}
 
開發者ID:RPTools,項目名稱:tokentool,代碼行數:24,代碼來源:TokenTool_Controller.java

示例3: tokenImageView_OnDragDetected

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@FXML
void tokenImageView_OnDragDetected(MouseEvent event) {
	Dragboard db = tokenImageView.startDragAndDrop(TransferMode.ANY);
	ClipboardContent content = new ClipboardContent();

	boolean saveAsToken = false;

	try {
		File tempTokenFile = fileSaveUtil.getTempFileName(saveAsToken, useFileNumberingCheckbox.isSelected(),
				fileNameTextField.getText(), fileNameSuffixTextField);

		writeTokenImage(tempTokenFile);
		content.putFiles(java.util.Collections.singletonList(tempTokenFile));
		tempTokenFile.deleteOnExit();
	} catch (Exception e) {
		log.error(e);
	} finally {
		content.putImage(tokenImageView.getImage());
		db.setContent(content);
		event.consume();
	}
}
 
開發者ID:RPTools,項目名稱:tokentool,代碼行數:23,代碼來源:TokenTool_Controller.java

示例4: copyImageToClipboard

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
public void copyImageToClipboard(WritableImage image) {
    ClipboardContent content = new ClipboardContent();
    content.putImage(image);
    Platform.runLater(() -> {
        Main.clipboard.setContent(content);
        Notifications.create().title("Notification").text("Image has been copied to the clipboard").showInformation();
    });
}
 
開發者ID:maximova136,項目名稱:j-demo,代碼行數:9,代碼來源:ScreenshotController.java

示例5: image

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
public static ClipboardContent image(Image i) {
	ClipboardContent c = new ClipboardContent();
	c.putImage(i);
	try {
		File f = File.createTempFile("snapshot", ".png");
		ImageIO.write(SwingFXUtils.fromFXImage(i, null), "png", f);
		c.putFiles(Arrays.asList(f));
		c.putUrl(f.toURI().toURL().toExternalForm());
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return c;
}
 
開發者ID:coalang-soft,項目名稱:dragdropfx,代碼行數:15,代碼來源:DnDPrepare.java

示例6: sourceSetOnDragDetected

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void sourceSetOnDragDetected(ImageView source, MouseEvent e) {
	Dragboard db = source.startDragAndDrop(TransferMode.COPY);
	ClipboardContent content = new ClipboardContent();
	Image sourceImage = source.getImage();
	String imageName = getImageName(sourceImage);
	content.putString(imageName);
	content.putImage(source.getImage());
	db.setContent(content);
	e.consume();
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:11,代碼來源:ScreenObjectHolder.java

示例7: prepareClipboardContent

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private ClipboardContent prepareClipboardContent() {
    ClipboardContent content = new ClipboardContent();
    if (sourceFormats.contains(DataFormat.PLAIN_TEXT)) {
        log("Source is putting string on dragboard");
        content.putString(CONTENT_PLAIN_TEXT);
    }
    if (sourceFormats.contains(DataFormat.URL)) {
        log("Source is putting URL on dragboard");
        content.putUrl(CONTENT_URL);
    }
    if (sourceFormats.contains(DataFormat.IMAGE)) {
        log("Source is putting image on dragboard");
        content.putImage(CONTENT_IMAGE);
    }
    if (sourceFormats.contains(DataFormat.HTML)) {
        log("Source is putting HTML on dragboard");
        content.putHtml(CONTENT_HTML);
    }
    if (sourceFormats.contains(DataFormat.RTF)) {
        log("Source is putting RTF on dragboard");
        content.putRtf(CONTENT_RTF);
    }
    if (sourceFormats.contains(DF_CUSTOM_BYTES)) {
        log("Source is putting custom four bytes on dragboard");
        content.put(DF_CUSTOM_BYTES, CONTENT_CUSTOM_BYTES);
    }
    if (sourceFormats.contains(DF_CUSTOM_STRING)) {
        log("Source is putting custom four bytes on dragboard");
        content.put(DF_CUSTOM_STRING, CONTENT_CUSTOM_STRING);
    }
    if (sourceFormats.contains(DF_CUSTOM_CLASS)) {
        log("Source is putting custom class on dragboard");
        content.put(DF_CUSTOM_CLASS, CONTENT_CUSTOM_CLASS);
    }
    if (sourceFormats.contains(DataFormat.FILES)) {
        log("Source is putting two files on dragboard");
        content.putFiles(CONTENT_FILES);
    }
    return content;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:41,代碼來源:DragDropWithControls.java

示例8: exportToClipboard

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
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);
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:12,代碼來源:JFreeChartUtils.java


注:本文中的javafx.scene.input.ClipboardContent.putImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。