use of java.awt.datatransfer.Clipboard in project javatari by ppeccin.
the class Monitor method loadCartridgePaste.
private void loadCartridgePaste() {
if (cartridgeChangeDisabledWarning())
return;
try {
Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable transf = clip.getContents("Ignored");
if (transf == null)
return;
Cartridge cart = ROMTransferHandlerUtil.importCartridgeData(transf);
if (cart != null)
cartridgeInsert(cart, true);
} catch (Exception ex) {
// Simply give up
}
}
use of java.awt.datatransfer.Clipboard in project zaproxy by zaproxy.
the class PopupMenuCopyUrls method performHistoryReferenceActions.
@Override
protected void performHistoryReferenceActions(List<HistoryReference> hrefs) {
StringBuilder sb = new StringBuilder();
for (HistoryReference href : hrefs) {
sb.append(href.getURI().toString());
sb.append("\n");
}
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(sb.toString()), this);
}
use of java.awt.datatransfer.Clipboard in project zaproxy by zaproxy.
the class ExtensionStdMenus method getClipboardContents.
private String getClipboardContents() {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
if (contents != null && contents.isDataFlavorSupported(DataFlavor.stringFlavor)) {
try {
return (String) contents.getTransferData(DataFlavor.stringFlavor);
} catch (UnsupportedFlavorException | IOException e) {
log.error("Unable to get data from clipboard");
}
}
return "";
}
use of java.awt.datatransfer.Clipboard in project bytecode-viewer by Konloch.
the class BinaryStatusPanel method positionCopyMenuItemActionPerformed.
// GEN-LAST:event_positionGoToMenuItemActionPerformed
private void positionCopyMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// GEN-FIRST:event_positionCopyMenuItemActionPerformed
try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(cursorPositionLabel.getText()), null);
} catch (IllegalStateException ex) {
// ignore issues with clipboard
}
}
use of java.awt.datatransfer.Clipboard in project jadx by skylot.
the class UiUtils method copyToClipboard.
public static void copyToClipboard(String text) {
if (StringUtils.isEmpty(text)) {
return;
}
try {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
StringSelection selection = new StringSelection(text);
clipboard.setContents(selection, selection);
} catch (Exception e) {
LOG.error("Failed copy text to clipboard", e);
}
}
Aggregations