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


Java ClipboardContent.putString方法代碼示例

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


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

示例1: initializeSetOnDragDetected

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void initializeSetOnDragDetected() {
//        LoggerFacade.INSTANCE.debug(this.getClass(), "Initialize setOnDragDetected"); // NOI18N
        
        super.setOnDragDetected(event -> {
            if (super.getItem() == null) {
                return;
            }

            final Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
            final ClipboardContent content = new ClipboardContent();
            content.putString(String.valueOf(super.getItem().getProjectId()));
//            dragboard.setDragView(
//                    birdImages.get(
//                            items.indexOf(
//                                    getItem()
//                            )
//                    )
//            );
            dragboard.setContent(content);
            event.consume();
        });
    }
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:23,代碼來源:ProjectItemCell.java

示例2: keyOnPressd

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

示例3: onCmdCopyEntryAttributes

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

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

示例5: copyValue

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

示例6: copy2clipboard

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void copy2clipboard(TableView source) {
	StringBuilder out = new StringBuilder();

	ObservableList<Integer> selectedCells = source.getSelectionModel().getSelectedIndices();

	int columns = source.getColumns().size();
	
	for (Integer row : selectedCells) {
		for (int idx = 0; idx < columns; idx++) {
			TableColumn tc = (TableColumn) source.getColumns().get(idx);
			Object item = tc.getCellData((int) row);
			out.append(item.toString());
			if (idx != columns - 1) {
				out.append('\t');
			}
		}
		out.append("\n");
	}

	ClipboardContent clipboardContent = new ClipboardContent();
	clipboardContent.putString(out.toString());
	Clipboard.getSystemClipboard().setContent(clipboardContent);

}
 
開發者ID:littleyoda,項目名稱:amazon.de-Orders,代碼行數:25,代碼來源:KeyEventHandlerTableview.java

示例7: handleCopySpectra

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

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
/** Copy currently selected widgets to clipboard
 *  @return Widgets that were copied or <code>null</code>
 */
public List<Widget> copyToClipboard()
{
    if (selection_tracker.isInlineEditorActive())
        return null;

    final List<Widget> widgets = selection.getSelection();
    if (widgets.isEmpty())
        return null;

    final String xml;
    try
    {
        xml = ModelWriter.getXML(widgets);
    }
    catch (Exception ex)
    {
        logger.log(Level.WARNING, "Cannot create content for clipboard", ex);
        return null;
    }

    final ClipboardContent content = new ClipboardContent();
    content.putString(xml);
    Clipboard.getSystemClipboard().setContent(content);
    return widgets;
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:29,代碼來源:DisplayEditor.java

示例9: handle

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
/**
 * @see javafx.event.EventHandler#handle(javafx.event.Event)
 */
@Override
public void handle(MouseEvent event)
{
	/* drag was detected, start a drag-and-drop gesture */
	/* allow any transfer mode */
	if (node_ != null)
	{
		Dragboard db = node_.startDragAndDrop(TransferMode.COPY);

		/* Put a string on a dragboard */
		String drag = idProvider_.getConceptId();
		if (drag != null && drag.length() > 0)
		{
			ClipboardContent content = new ClipboardContent();
			content.putString(drag);
			db.setContent(content);
			AppContext.getService(DragRegistry.class).conceptDragStarted();
			event.consume();
		}
	}
}
 
開發者ID:Apelon-VA,項目名稱:ISAAC,代碼行數:25,代碼來源:DragDetectedEventHandler.java

示例10: copy

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
/**
 * Transfers the currently selected text to the clipboard,
 * leaving the current selection.
 */
default void copy() {
    IndexRange selection = getSelection();
    if(selection.getLength() > 0) {
        ClipboardContent content = new ClipboardContent();

        content.putString(getSelectedText());

        getStyleCodecs().ifPresent(codecs -> {
            Codec<StyledDocument<PS, SEG, S>> codec = ReadOnlyStyledDocument.codec(codecs._1, codecs._2, getSegOps());
            DataFormat format = dataFormat(codec.getName());
            StyledDocument<PS, SEG, S> doc = subDocument(selection.getStart(), selection.getEnd());
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(os);
            try {
                codec.encode(dos, doc);
                content.put(format, os.toByteArray());
            } catch (IOException e) {
                System.err.println("Codec error: Exception in encoding '" + codec.getName() + "':");
                e.printStackTrace();
            }
        });

        Clipboard.getSystemClipboard().setContent(content);
    }
}
 
開發者ID:FXMisc,項目名稱:RichTextFX,代碼行數:30,代碼來源:ClipboardActions.java

示例11: copyAddress

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
@FXML
public void copyAddress(ActionEvent event) {
       try {
       	ClipboardContent content = new ClipboardContent();
		content.putString(getAddress());
		Clipboard.getSystemClipboard().setContent(content);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:ForJ-Latech,項目名稱:fwm,代碼行數:11,代碼來源:JettyController.java

示例12: copyButtonAction

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

示例13: dragStart

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void dragStart (MouseEvent event) {
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent cc = new ClipboardContent();
    db.setDragView(myFactory.getTransferImage(this), 0, 0);
    cc.putString(serialize(getItem(), getListView().getItems().indexOf(getItem())));
    db.setContent(cc);
    event.consume();
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:9,代碼來源:WaveDragCell.java

示例14: dragStart

import javafx.scene.input.ClipboardContent; //導入方法依賴的package包/類
private void dragStart () {
    Dragboard db = startDragAndDrop(TransferMode.COPY);
    ClipboardContent cc = new ClipboardContent();
    cc.putString(HOLDER);
    db.setContent(cc);
    db.setDragView(getDragImage());
    myTarget.draw().setOnDragOver(event -> dragOver(event));
    myTarget.draw().setOnDragDropped(event -> drop(event));
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:10,代碼來源:WaveDropCell.java

示例15: copyAddress

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


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