java.awt.datatransfer.ClipboardOwner Java Examples
The following examples show how to use
java.awt.datatransfer.ClipboardOwner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SunClipboard.java From Bytecoder with Apache License 2.0 | 6 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(() -> oldOwner.lostOwnership(SunClipboard.this, oldContents)); } } }
Example #2
Source File: AmidstMenu.java From AMIDST with GNU General Public License v3.0 | 6 votes |
private CopySeedMenuItem() { super("Copy Seed to Clipboard"); setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_DOWN_MASK)); addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { StringSelection stringSelection = new StringSelection(Options.instance.seed + ""); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, new ClipboardOwner() { @Override public void lostOwnership(Clipboard arg0, Transferable arg1) { // TODO Auto-generated method stub } }); } }); }
Example #3
Source File: NetworkAssistedEngine.java From Dayon with GNU General Public License v3.0 | 6 votes |
public NetworkAssistedEngine(NetworkCaptureConfigurationMessageHandler captureConfigurationHandler, NetworkCompressorConfigurationMessageHandler compressorConfigurationHandler, NetworkControlMessageHandler controlHandler, NetworkClipboardRequestMessageHandler clipboardRequestHandler, ClipboardOwner clipboardOwner) { this.captureConfigurationHandler = captureConfigurationHandler; this.compressorConfigurationHandler = compressorConfigurationHandler; this.controlHandler = controlHandler; this.clipboardRequestHandler = clipboardRequestHandler; this.clipboardOwner = clipboardOwner; this.receiver = new Thread(new RunnableEx() { @Override protected void doRun() throws Exception { NetworkAssistedEngine.this.receivingLoop(); } }, "CommandReceiver"); this.fileReceiver = new Thread(new RunnableEx() { @Override protected void doRun() throws Exception { NetworkAssistedEngine.this.fileReceivingLoop(); } }, "FileReceiver"); }
Example #4
Source File: GetContentsInterruptedTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void execute() { System.out.println("Hello world"); final ClipboardOwner clipboardOwner = new ClipboardOwner() { public void lostOwnership(Clipboard clipboard, Transferable contents) { System.exit(0); } }; clipboard.setContents(transferable, clipboardOwner); synchronized (o) { try { o.wait(); } catch (InterruptedException ie) { ie.printStackTrace(); } } }
Example #5
Source File: SunClipboard.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(() -> oldOwner.lostOwnership(SunClipboard.this, oldContents)); } } }
Example #6
Source File: PasteAction.java From netbeans with Apache License 2.0 | 6 votes |
public void actionPerformed(ActionEvent ev) { try { Transferable trans = t.paste(); Clipboard clipboard = getClipboard(); if (trans != null) { ClipboardOwner owner = (trans instanceof ClipboardOwner) ? (ClipboardOwner) trans : new StringSelection(""); // NOI18N clipboard.setContents(trans, owner); } } catch (UserCancelException exc) { // ignore - user just pressed cancel in some dialog.... } catch (IOException e) { Exceptions.printStackTrace(e); } finally { EventQueue.invokeLater(this); } }
Example #7
Source File: NbClipboard.java From netbeans with Apache License 2.0 | 6 votes |
private synchronized void superSetContents(Transferable t, ClipboardOwner o) { if (this.contents != null) { transferableOwnershipLost(this.contents); } final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; this.owner = o; this.contents = t; if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { @Override public void run() { oldOwner.lostOwnership(NbClipboard.this, oldContents); } }); } }
Example #8
Source File: SunClipboard.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #9
Source File: SunClipboard.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #10
Source File: PlayerControls.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
private void putImageToClipBoard(BufferedImage img) { if (img == null) { return; } TransferableImage trans = new TransferableImage(img); Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard(); c.setContents(trans, new ClipboardOwner() { @Override public void lostOwnership(Clipboard clipboard, Transferable contents) { } }); }
Example #11
Source File: SunClipboard.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #12
Source File: SunClipboard.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #13
Source File: SunClipboard.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #14
Source File: SunClipboard.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #15
Source File: SunClipboard.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #16
Source File: SunClipboard.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #17
Source File: SunClipboard.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #18
Source File: SunClipboard.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #19
Source File: SunClipboard.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #20
Source File: SunClipboard.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #21
Source File: SunClipboard.java From hottub with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #22
Source File: SunClipboard.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #23
Source File: SunClipboard.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #24
Source File: NbClipboardTest.java From netbeans with Apache License 2.0 | 5 votes |
@Override public synchronized void setContents(Transferable contents, ClipboardOwner owner) { setContentsCounter++; if( pretendToBeBusy ) { pretendToBeBusy = false; throw new IllegalStateException(); } super.setContents(contents, owner); }
Example #25
Source File: SunClipboard.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #26
Source File: SunClipboard.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #27
Source File: SunClipboard.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { // 4378007 : Toolkit.getSystemClipboard().setContents(null, null) // should throw NPE if (contents == null) { throw new NullPointerException("contents"); } initContext(); final ClipboardOwner oldOwner = this.owner; final Transferable oldContents = this.contents; try { this.owner = owner; this.contents = new TransferableProxy(contents, true); setContentsNative(contents); } finally { if (oldOwner != null && oldOwner != owner) { EventQueue.invokeLater(new Runnable() { public void run() { oldOwner.lostOwnership(SunClipboard.this, oldContents); } }); } } }
Example #28
Source File: SunClipboard.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }
Example #29
Source File: ExplorerPanelTest.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void setContents (Transferable t, ClipboardOwner o) { super.setContents (t, o); fireClipboardChange (); FlavorEvent ev = new FlavorEvent(this); for (FlavorListener flavorListener : getFlavorListeners()) { flavorListener.flavorsChanged(ev); } }
Example #30
Source File: SunClipboard.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void lostOwnershipNow(final AppContext disposedContext) { final SunClipboard sunClipboard = SunClipboard.this; ClipboardOwner owner = null; Transferable contents = null; synchronized (sunClipboard) { final AppContext context = sunClipboard.contentsContext; if (context == null) { return; } if (disposedContext == null || context == disposedContext) { owner = sunClipboard.owner; contents = sunClipboard.contents; sunClipboard.contentsContext = null; sunClipboard.owner = null; sunClipboard.contents = null; sunClipboard.clearNativeContext(); context.removePropertyChangeListener (AppContext.DISPOSED_PROPERTY_NAME, sunClipboard); } else { return; } } if (owner != null) { owner.lostOwnership(sunClipboard, contents); } }