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


Java Clipboard.setContent方法代碼示例

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


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

示例1: execute

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

    final Array<ResourceElement> elements = getElements();
    final Array<Path> files = ArrayFactory.newArray(Path.class, elements.size());
    elements.forEach(files, (resource, toStore) -> toStore.add(resource.getFile()));

    final ClipboardContent content = new ClipboardContent();

    EditorUtil.addCopiedFile(files, content);

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

示例2: execute

import javafx.scene.input.Clipboard; //導入方法依賴的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

示例3: keyOnPressd

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
private void keyOnPressd(KeyEvent e) {

		if (e.isControlDown() && e.getCode() == KeyCode.C) {

			if (e.isConsumed())
				return;

			ObservableList<TreeItem<XMLMeta>> items = this.getSelectionModel().getSelectedItems();
			Clipboard c = Clipboard.getSystemClipboard();
			ClipboardContent cc = new ClipboardContent();

			StringBuffer sb = new StringBuffer();
			for (TreeItem<XMLMeta> item : items) {
				sb.append(item.getValue().getText()).append("\n");
			}
			cc.putString(sb.toString());
			c.setContent(cc);

			e.consume();
		}

	}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:23,代碼來源:XMLTreeView.java

示例4: copyValue

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@FXML
void copyValue() {
  if (!tableTree.isFocused()) {
    return;
  }
  TreeItem<ReferenceDescription> item = tableTree.getSelectionModel().getSelectedItem();
  if (item != null && item.getValue() != null) {
    try {
      StringWriter writer = new StringWriter();
      XmlEncoder encoder = new XmlEncoder();
      encoder.setOutput(writer);
      writer.write("<ReferenceDescription>");
      ReferenceDescription.encode(item.getValue(), encoder);
      writer.write("</ReferenceDescription>");
      writer.flush();

      Clipboard clipboard = Clipboard.getSystemClipboard();
      ClipboardContent content = new ClipboardContent();
      content.putString(writer.toString());
      clipboard.setContent(content);
    } catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
  }
}
 
開發者ID:comtel2000,項目名稱:opc-ua-client,代碼行數:26,代碼來源:DataTreeViewPresenter.java

示例5: onCmdCopyEntry

import javafx.scene.input.Clipboard; //導入方法依賴的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

示例6: onCmdCopyEntryAttributes

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@SuppressWarnings("unused")
@FXML
void onCmdCopyEntryAttributes(ActionEvent evt) {
	TreeItem<AttributeModel> rootItem = this.ctlDetailsView.getRoot();

	if (rootItem != null) {
		StringWriter buffer = new StringWriter();
		PrintWriter writer = new PrintWriter(buffer);

		for (TreeItem<AttributeModel> attributeItem : rootItem.getChildren()) {
			copyEntryAttributesHelper(writer, attributeItem, "");
		}

		writer.flush();

		Clipboard clipboard = Clipboard.getSystemClipboard();
		ClipboardContent content = new ClipboardContent();

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

示例7: handleCopySpectra

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
public void handleCopySpectra(Event event) {
  StringBuilder sb = new StringBuilder();
  for (MsSpectrumDataSet dataset : datasets) {
    MsSpectrum spectrum = dataset.getSpectrum();
    String spectrumString = TxtExportAlgorithm.spectrumToString(spectrum);
    String splash = SplashCalculationAlgorithm.calculateSplash(spectrum);
    sb.append("# ");
    sb.append(dataset.getName());
    sb.append("\n");
    sb.append("# SPLASH ID: ");
    sb.append(splash);
    sb.append("\n");
    sb.append(spectrumString);
    sb.append("\n");
  }
  final Clipboard clipboard = Clipboard.getSystemClipboard();
  final ClipboardContent content = new ClipboardContent();
  content.putString(sb.toString());
  clipboard.setContent(content);
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:21,代碼來源:MsSpectrumPlotWindowController.java

示例8: editCopyImageMenu_onAction

import javafx.scene.input.Clipboard; //導入方法依賴的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

示例9: copyButtonAction

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@FXML
private void copyButtonAction(ActionEvent event) {
    String fullText = makeStringFromTextFlow();
    final Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putString(fullText);
    clipboard.setContent(content);
}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:9,代碼來源:ExpressionBuilderController.java

示例10: copy

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
private void copy(ObservableList<TreeItem<Resource>> selectedItems) {
    Clipboard clipboard = Clipboard.getSystemClipboard();
    Map<DataFormat, Object> content = new HashMap<>();
    for (TreeItem<Resource> treeItem : selectedItems) {
        Resource resource = treeItem.getValue();
        if (resource != null) {
            if (!resource.copy(content)) {
                FXUIUtils.showMessageDialog(null, "Clipboard operation failed", "Unhandled resource selection",
                        AlertType.ERROR);
            }
        }
    }
    clipboard.setContent(content);
    clipboardOperation = Operation.COPY;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:16,代碼來源:ResourceView.java

示例11: copyAddress

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@FXML
protected void copyAddress(ActionEvent event) {
    // User clicked icon or menu item.
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.putString(addressStr.get());
    content.putHtml(String.format("<a href='%s'>%s</a>", uri(), addressStr.get()));
    clipboard.setContent(content);
}
 
開發者ID:creativechain,項目名稱:creacoinj,代碼行數:10,代碼來源:ClickableBitcoinAddress.java

示例12: copySelectionToClipboard

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
public void copySelectionToClipboard()
{
	//http://stackoverflow.com/questions/13929371/copy-and-paste-in-codemirror-js-embeded-in-javafx-application
	final Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putString(getSelectedText());
    clipboard.setContent(content);
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:9,代碼來源:CodeEditor.java

示例13: copyCliboard

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@FXML
public void copyCliboard() {
    final Clipboard clipboard = Clipboard.getSystemClipboard();
    final ClipboardContent content = new ClipboardContent();
    content.putString(posledniUctenka);
    clipboard.setContent(content);
}
 
開發者ID:zbycz,項目名稱:altaeet,代碼行數:8,代碼來源:Controller.java

示例14: run

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

    int row = tableView.getSelectionModel().getSelectedIndex();
    ObservableList<TablePosition> selectedCells = tableView.getSelectionModel().getSelectedCells();
    if (!selectedCells.isEmpty()) {
        TablePosition tablePosition = selectedCells.get(0);
        Object cellData = tablePosition.getTableColumn().getCellData(row);
        content.putString(Objects.toString(cellData));
        clipboard.setContent(content);
    }
}
 
開發者ID:Kindrat,項目名稱:cassandra-client,代碼行數:15,代碼來源:TableCellCopyHandler.java

示例15: process

import javafx.scene.input.Clipboard; //導入方法依賴的package包/類
@Override
@FXThread
protected void process() {
    super.process();

    final TreeNode<?> node = getNode();

    final ClipboardContent content = new ClipboardContent();
    content.put(DATA_FORMAT, node.getObjectId());

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


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