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


Java ClipboardContent.putFiles方法代碼示例

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


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

示例1: execute

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@FXThread
@Override
protected void execute(@Nullable final ActionEvent event) {
    super.execute(event);

    final List<File> files = getElements().stream()
            .map(ResourceElement::getFile)
            .map(Path::toFile)
            .collect(toList());

    final ClipboardContent content = new ClipboardContent();
    content.putFiles(files);
    content.put(EditorUtil.JAVA_PARAM, "cut");

    final Clipboard clipboard = Clipboard.getSystemClipboard();
    clipboard.setContent(content);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:18,代碼來源:CutFileAction.java

示例2: treeProjectFileOnDragDetected

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
/**
 * 트리 드래그 디텍트 이벤트 처리. <br/>
 * 트리내에 구성된 파일의 위치정보를 드래그 드롭 기능으로 <br/>
 * 전달해주는 역할을 수행한다.<br/>
 * <br/>
 * 
 * @작성자 : KYJ
 * @작성일 : 2017. 11. 21.
 * @param ev
 */
public void treeProjectFileOnDragDetected(MouseEvent ev) {
	TreeItem<JavaProjectFileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
	if (selectedItem == null || selectedItem.getValue() == null) {
		return;
	}

	File file = selectedItem.getValue().getFile();
	if (file == null || !file.exists())
		return;

	Dragboard board = treeProjectFile.startDragAndDrop(TransferMode.LINK);
	ClipboardContent content = new ClipboardContent();
	content.putFiles(Arrays.asList(file));
	board.setContent(content);

	ev.consume();
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:28,代碼來源:SystemLayoutViewController.java

示例3: onCmdCopyEntry

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@SuppressWarnings("unused")
@FXML
void onCmdCopyEntry(ActionEvent evt) {
	UserCertStoreEntry entry = getSelectedStoreEntry();

	if (entry != null) {
		List<Path> entryFilePaths = entry.getFilePaths();

		if (!entryFilePaths.isEmpty()) {
			List<File> entryFiles = entryFilePaths.stream().map((p) -> p.toFile()).collect(Collectors.toList());
			Clipboard clipboard = Clipboard.getSystemClipboard();
			ClipboardContent content = new ClipboardContent();

			content.putFiles(entryFiles);
			clipboard.setContent(content);
		}
	}
}
 
開發者ID:hdecarne,項目名稱:certmgr,代碼行數:19,代碼來源:StoreController.java

示例4: 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

示例5: 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

示例6: 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

示例7: startDragFile

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void startDragFile(MouseEvent me) {
   Dragboard db = startDragAndDrop(TransferMode.ANY);
   db.setDragView(snapshot(new SnapshotParameters(), null));

   ClipboardContent filesToCopyClipboard = new ClipboardContent();
   filesToCopyClipboard.putFiles(Collections.singletonList(getFile()));
   db.setContent(filesToCopyClipboard);
   me.consume();		
}
 
開發者ID:salimvanak,項目名稱:myWMS,代碼行數:10,代碼來源:FileOutputPane.java

示例8: 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

示例9: copyResources

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void copyResources(boolean cut) {
  Clipboard clipboard = Clipboard.getSystemClipboard();
  ClipboardContent content = new ClipboardContent();
  List<File> files = fileExplorer.getSelectedItems().stream()//
      .map(it -> ((Path) it.getNativeResourceObject()).toFile())//
      .collect(Collectors.toList());
  content.putFiles(files);
  content.put(CUT, cut);
  clipboard.setContent(content);
}
 
開發者ID:Adrodoc55,項目名稱:MPL,代碼行數:11,代碼來源:MplIdeController.java

示例10: onDragDetected

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@FXML
void onDragDetected(MouseEvent event) {
	if(outputFilePath != null) {
		Dragboard db = outputDirTextField.startDragAndDrop(TransferMode.ANY);
		ClipboardContent content = new ClipboardContent();
		Vector<File> files = new Vector<File>();
		files.add(new File(outputFilePath));
		content.putFiles(files);
		db.setContent(content);
	}
	event.consume();
}
 
開發者ID:liudonghua123,項目名稱:signapk_fx,代碼行數:13,代碼來源:MainPaneController.java

示例11: addCopiedFile

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
/**
 * Added files like files to copy to clipboard content.
 *
 * @param paths   the list of files.
 * @param content the content to store.
 */
@FXThread
public static void addCopiedFile(@NotNull final Array<Path> paths, @NotNull final ClipboardContent content) {

    final List<File> files = paths.stream()
            .map(Path::toFile)
            .collect(toList());

    content.putFiles(files);
    content.put(EditorUtil.JAVA_PARAM, "copy");

    final Platform platform = JmeSystem.getPlatform();

    if (platform == Platform.Linux64 || platform == Platform.Linux32) {

        final StringBuilder builder = new StringBuilder("copy\n");

        paths.forEach(builder, (path, b) ->
                b.append(path.toUri().toASCIIString()).append('\n'));

        builder.delete(builder.length() - 1, builder.length());

        final ByteBuffer buffer = ByteBuffer.allocate(builder.length());

        for (int i = 0, length = builder.length(); i < length; i++) {
            buffer.put((byte) builder.charAt(i));
        }

        buffer.flip();

        content.put(GNOME_FILES, buffer);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:39,代碼來源:EditorUtil.java


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