-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.4
-
sparc
-
solaris_2.5.1
Name: diC59631 Date: 10/03/97
1.
1.1 javac SetClipboardTest.java
1.2 java SetClipboard
2.
import java.awt.*;
import java.awt.datatransfer.*;
class SetClipboardTest2 extends Thread implements ClipboardOwner{
String content;
public void lostOwnership(Clipboard clipboard, Transferable contents) {
// okay......
System.out.println("-->content \""+contents+"\" in clipboard lost ownership...");
}
/**
* Set the clipboard with the given string.
*/
public SetClipboardTest2(String content) {
this.content = content;
}
/**
* Put something on the clipboard
*/
public void run() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Clipboard cb = toolkit.getSystemClipboard();
StringSelection currentClip = new StringSelection(content);
System.out.print("[1] Setting clipboard content first time ... ");
cb.setContents(currentClip, this);
System.out.println("done!");
System.out.print("[2] Setting clipboard content second time ... ");
cb.setContents(currentClip, this);
System.out.println("done!");
System.exit(0);
}
public static void main(String arg[]) {
System.out.println("-=[ CLIPBOARD TEST ]=-");
new Thread(new SetClipboardTest2("test")).start();
}
}
3.
-=[ CLIPBOARD TEST ]=-
[1] Setting clipboard content first time ... done!
[2] Setting clipboard content second time ... -->content "java.awt.datatransfer.StringSelection@1dce088c" in clipboard lost ownership...
done!
4.
none.
5.
none.
======================================================================
- relates to
-
JDK-4060810 Win32: multiple setContents calls caused clipboard to send lostOwnership msg.
-
- Closed
-