Search in sources :

Example 11 with Clipboard

use of javafx.scene.input.Clipboard in project jgnash by ccavanaugh.

the class TableViewEx method handleCopyToClipboard.

public void handleCopyToClipboard() {
    final List<S> items = getSelectionModel().getSelectedItems();
    if (items.size() > 0 && getClipBoardStringFunction() != null) {
        final Clipboard clipboard = Clipboard.getSystemClipboard();
        final ClipboardContent content = new ClipboardContent();
        final StringBuilder builder = new StringBuilder();
        for (final S item : items) {
            builder.append(getClipBoardStringFunction().apply(item));
            builder.append('\n');
        }
        content.putString(builder.toString());
        clipboard.setContent(content);
    }
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) Clipboard(javafx.scene.input.Clipboard)

Example 12 with Clipboard

use of javafx.scene.input.Clipboard in project tokentool by RPTools.

the class TokenTool_Controller method editCopyImageMenu_OnAction.

@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);
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) Clipboard(javafx.scene.input.Clipboard) File(java.io.File) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Example 13 with Clipboard

use of javafx.scene.input.Clipboard in project PayFile by mikehearn.

the class ClickableBitcoinAddress method copyAddress.

@FXML
protected void copyAddress(ActionEvent event) {
    // User clicked icon or menu item.
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.putString(getAddress());
    content.putHtml(String.format("<a href='%s'>%s</a>", uri(), getAddress()));
    clipboard.setContent(content);
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) Clipboard(javafx.scene.input.Clipboard) FXML(javafx.fxml.FXML)

Example 14 with Clipboard

use of javafx.scene.input.Clipboard in project bitsquare by bitsquare.

the class Utilities method copyToClipboard.

public static void copyToClipboard(String content) {
    try {
        if (content != null && content.length() > 0) {
            Clipboard clipboard = Clipboard.getSystemClipboard();
            ClipboardContent clipboardContent = new ClipboardContent();
            clipboardContent.putString(content);
            clipboard.setContent(clipboardContent);
        }
    } catch (Throwable e) {
        log.error("copyToClipboard failed " + e.getMessage());
        e.printStackTrace();
    }
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) Clipboard(javafx.scene.input.Clipboard)

Example 15 with Clipboard

use of javafx.scene.input.Clipboard in project certmgr by hdecarne.

the class StoreController method onCmdCopyEntryDN.

@SuppressWarnings("unused")
@FXML
void onCmdCopyEntryDN(ActionEvent evt) {
    TreeItem<StoreEntryModel> selectedItem = this.ctlStoreEntryView.getSelectionModel().getSelectedItem();
    if (selectedItem != null) {
        Clipboard clipboard = Clipboard.getSystemClipboard();
        ClipboardContent content = new ClipboardContent();
        content.putString(selectedItem.getValue().getName());
        clipboard.setContent(content);
    }
}
Also used : ClipboardContent(javafx.scene.input.ClipboardContent) Clipboard(javafx.scene.input.Clipboard) FXML(javafx.fxml.FXML)

Aggregations

Clipboard (javafx.scene.input.Clipboard)24 ClipboardContent (javafx.scene.input.ClipboardContent)18 FXML (javafx.fxml.FXML)12 IOException (java.io.IOException)7 File (java.io.File)4 StringWriter (java.io.StringWriter)3 UserCertStore (de.carne.certmgr.certs.UserCertStore)2 UserCertStoreEntry (de.carne.certmgr.certs.UserCertStoreEntry)2 Images (de.carne.certmgr.jfx.resources.Images)2 UserCertStoreTreeTableViewHelper (de.carne.certmgr.jfx.util.UserCertStoreTreeTableViewHelper)2 PathPreference (de.carne.certmgr.util.PathPreference)2 Nullable (de.carne.check.Nullable)2 PlatformHelper (de.carne.jfx.application.PlatformHelper)2 Alerts (de.carne.jfx.scene.control.Alerts)2 StageController (de.carne.jfx.stage.StageController)2 Lazy (de.carne.util.Lazy)2 Path (java.nio.file.Path)2 List (java.util.List)2 Preferences (java.util.prefs.Preferences)2 Collectors (java.util.stream.Collectors)2