Search in sources :

Example 66 with Clipboard

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
    }
}
Also used : Cartridge(org.javatari.atari.cartridge.Cartridge) Transferable(java.awt.datatransfer.Transferable) Clipboard(java.awt.datatransfer.Clipboard) IOException(java.io.IOException) AccessControlException(java.security.AccessControlException)

Example 67 with Clipboard

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);
}
Also used : HistoryReference(org.parosproxy.paros.model.HistoryReference) Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 68 with Clipboard

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 "";
}
Also used : Transferable(java.awt.datatransfer.Transferable) Clipboard(java.awt.datatransfer.Clipboard) IOException(java.io.IOException) UnsupportedFlavorException(java.awt.datatransfer.UnsupportedFlavorException)

Example 69 with Clipboard

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
    }
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 70 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);
    }
}
Also used : Clipboard(java.awt.datatransfer.Clipboard) JadxRuntimeException(jadx.core.utils.exceptions.JadxRuntimeException) StringSelection(java.awt.datatransfer.StringSelection)

Aggregations

Clipboard (java.awt.datatransfer.Clipboard)181 StringSelection (java.awt.datatransfer.StringSelection)117 Transferable (java.awt.datatransfer.Transferable)44 IOException (java.io.IOException)30 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)16 JDialog (javax.swing.JDialog)12 JOptionPane (javax.swing.JOptionPane)12 ActionEvent (java.awt.event.ActionEvent)11 Flame (org.jwildfire.create.tina.base.Flame)10 ActionListener (java.awt.event.ActionListener)8 JButton (javax.swing.JButton)8 JScrollPane (javax.swing.JScrollPane)8 JMenuItem (javax.swing.JMenuItem)7 JPanel (javax.swing.JPanel)7 JTextArea (javax.swing.JTextArea)7 Foundation (org.concord.energy3d.model.Foundation)7 HousePart (org.concord.energy3d.model.HousePart)7 FlameReader (org.jwildfire.create.tina.io.FlameReader)7 RenderedFlame (org.jwildfire.create.tina.render.RenderedFlame)7 Point (java.awt.Point)6