use of javafx.scene.input.Clipboard in project certmgr by hdecarne.
the class StoreController method onCmdCopyEntryAttribute.
@SuppressWarnings("unused")
@FXML
void onCmdCopyEntryAttribute(ActionEvent evt) {
TreeItem<AttributeModel> selectedItem = this.ctlDetailsView.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
Clipboard clipboard = Clipboard.getSystemClipboard();
ClipboardContent content = new ClipboardContent();
content.putString(selectedItem.getValue().toString());
clipboard.setContent(content);
}
}
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);
}
use of javafx.scene.input.Clipboard in project RichTextFX by FXMisc.
the class ClipboardHelper method paste.
/**
* Inserts the content from the clipboard into this text-editing area,
* replacing the current selection. If there is no selection, the content
* from the clipboard is inserted at the current caret position.
*/
default void paste() {
Clipboard clipboard = Clipboard.getSystemClipboard();
if (getStyleCodecs().isPresent()) {
Tuple2<Codec<PS>, Codec<StyledSegment<SEG, S>>> codecs = getStyleCodecs().get();
Codec<StyledDocument<PS, SEG, S>> codec = ReadOnlyStyledDocument.codec(codecs._1, codecs._2, getSegOps());
DataFormat format = dataFormat(codec.getName());
if (clipboard.hasContent(format)) {
byte[] bytes = (byte[]) clipboard.getContent(format);
ByteArrayInputStream is = new ByteArrayInputStream(bytes);
DataInputStream dis = new DataInputStream(is);
StyledDocument<PS, SEG, S> doc = null;
try {
doc = codec.decode(dis);
} catch (IOException e) {
System.err.println("Codec error: Failed to decode '" + codec.getName() + "':");
e.printStackTrace();
}
if (doc != null) {
replaceSelection(doc);
return;
}
}
}
if (clipboard.hasString()) {
String text = clipboard.getString();
if (text != null) {
replaceSelection(text);
}
}
}
use of javafx.scene.input.Clipboard in project Krothium-Launcher by DarkLBP.
the class OutputFX method copySelected.
@FXML
public final void copySelected() {
if (!outputList.getSelectionModel().getSelectedItems().isEmpty()) {
Clipboard clipboard = Clipboard.getSystemClipboard();
ClipboardContent content = new ClipboardContent();
StringBuilder b = new StringBuilder();
for (String s : outputList.getSelectionModel().getSelectedItems()) {
b.append(s).append('\n');
}
content.putString(b.toString());
clipboard.setContent(content);
}
}
use of javafx.scene.input.Clipboard in project trex-stateless-gui by cisco-system-traffic-generator.
the class LogsView method copyToClipboard.
/**
* Copy logs to clipboard
*/
public void copyToClipboard() {
final Clipboard clipboard = Clipboard.getSystemClipboard();
final ClipboardContent content = new ClipboardContent();
content.putString(sb.toString());
clipboard.setContent(content);
}
Aggregations