KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > swingwt > awt > datatransfer > Clipboard


1 /*
2    SwingWT
3    Copyright(c)2003-2004, R. Rawson-Tetley
4
5    For more information on distributing and using this program, please
6    see the accompanying "COPYING" file.
7
8    Contact me by electronic mail: bobintetley@users.sourceforge.net
9
10    $Log: Clipboard.java,v $
11    Revision 1.2 2004/05/05 12:43:19 bobintetley
12    Patches/new files from Laurent Martell
13
14    Revision 1.1 2004/01/20 07:38:05 bobintetley
15    Bug fixes and compatibility methods
16
17    Revision 1.4 2003/12/14 09:13:38 bobintetley
18    Added CVS log to source headers
19
20 */

21
22 package swingwt.awt.datatransfer;
23
24 import org.eclipse.swt.dnd.*;
25
26 /**
27  * This class differs slightly from the AWT implementation.
28  * Mostly because type mapping is massively different between
29  * the AWT and SWT implementations, so this works, you can knock
30  * a couple of parameters off your calls, but it's woefully
31  * inadequate and can only handle text.
32  *
33  */

34 public class Clipboard {
35
36     private org.eclipse.swt.dnd.Clipboard clip = new org.eclipse.swt.dnd.Clipboard(swingwtx.swing.SwingWTUtils.getDisplay());
37     
38     public Clipboard() {}
39     
40     public Object JavaDoc getContents() {
41         return clip.getContents(TextTransfer.getInstance());
42     }
43     
44     /** NOT IMPLEMENTED - use setContents(Object) for now */
45     public void setContents(Transferable contents, ClipboardOwner owner) {
46     }
47     
48     /** NOT IMPLEMENTED - use getContents() */
49     public Transferable getContents(Object JavaDoc owner) {
50         return null;
51     }
52     
53     public String JavaDoc getName() {
54         return "";
55     }
56     
57     public void setContents(Object JavaDoc contents) {
58         clip.setContents(new Object JavaDoc[] { contents }, new Transfer[] { TextTransfer.getInstance() });
59     }
60     
61 }
62
Popular Tags