当前位置: 首页>>代码示例>>Java>>正文


Java Clipboard.getSystemClipboard方法代码示例

本文整理汇总了Java中javafx.scene.input.Clipboard.getSystemClipboard方法的典型用法代码示例。如果您正苦于以下问题:Java Clipboard.getSystemClipboard方法的具体用法?Java Clipboard.getSystemClipboard怎么用?Java Clipboard.getSystemClipboard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.input.Clipboard的用法示例。


在下文中一共展示了Clipboard.getSystemClipboard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillContextMenu

import javafx.scene.input.Clipboard; //导入方法依赖的package包/类
/**
 * Fill the items actions for this node.
 *
 * @param nodeTree the node tree
 * @param items    the items
 */
@FXThread
public void fillContextMenu(@NotNull final NodeTree<?> nodeTree, @NotNull final ObservableList<MenuItem> items) {
    if (canEditName()) items.add(new RenameNodeAction(nodeTree, this));
    if (canCopy()) items.add(new CopyNodeAction(nodeTree, this));

    final Clipboard clipboard = Clipboard.getSystemClipboard();
    final Object content = clipboard.getContent(DATA_FORMAT);
    if (!(content instanceof Long)) {
        return;
    }

    final Long objectId = (Long) content;
    final TreeItem<?> treeItem = UIUtils.findItem(nodeTree.getTreeView(), objectId);
    final TreeNode<?> treeNode = treeItem == null ? null : (TreeNode<?>) treeItem.getValue();

    if (treeNode != null && canAccept(treeNode, true)) {
        items.add(new PasteNodeAction(nodeTree, this, treeNode));
    }
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:26,代码来源:TreeNode.java

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

示例3: execute

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

    final Clipboard clipboard = Clipboard.getSystemClipboard();
    if (clipboard == null) return;

    final List<File> files = unsafeCast(clipboard.getContent(DataFormat.FILES));
    if (files == null || files.isEmpty()) return;

    final Path currentFile = getElement().getFile();
    final boolean isCut = "cut".equals(clipboard.getContent(EditorUtil.JAVA_PARAM));

    if (isCut) {
        files.forEach(file -> moveFile(currentFile, file.toPath()));
    } else {
        files.forEach(file -> copyFile(currentFile, file.toPath()));
    }

    clipboard.clear();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:PasteFileAction.java

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

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

示例6: pasteHandler

import javafx.scene.input.Clipboard; //导入方法依赖的package包/类
/**
 * 붙여넣기 핸들링 <br/>
 * 
 * 10.26 이미지 붙여넣기
 * 
 * @작성자 : KYJ
 * @작성일 : 2017. 10. 26.
 * @param ev
 */
protected void pasteHandler(KeyEvent ev) {
	Clipboard systemClipboard = Clipboard.getSystemClipboard();
	Set<DataFormat> contentTypes = systemClipboard.getContentTypes();
	LOGGER.debug("{}", contentTypes);

	List<File> files = systemClipboard.getFiles();

	if (systemClipboard.getImage() != null) {
		pasteImage(systemClipboard.getImage());
	} else if (files != null) {

		for (File f : files) {
			try {
				String contentType = Files.probeContentType(f.toPath());
				LOGGER.debug(contentType);
				if (contentType.startsWith("image/")) {
					pasteImage(contentType, FileUtil.getBytes(f));
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:34,代码来源:TinymceDeligator.java

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

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

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

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

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

示例12: SystemClipboard

import javafx.scene.input.Clipboard; //导入方法依赖的package包/类
public SystemClipboard() {
    clipboard = Clipboard.getSystemClipboard();
    Timeline monitorTask = new Timeline(new KeyFrame(Duration.millis(200), this));
    monitorTask.setCycleCount(Animation.INDEFINITE);
    monitorTask.play();
    prevData = null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:SystemClipboard.java

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

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

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


注:本文中的javafx.scene.input.Clipboard.getSystemClipboard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。