agent_x91
10-05-2004, 08:32 AM
how can java be used to copy a string to the clipboard, and paste from the clipboard?
thanks
thanks
|
Click to See Complete Forum and Search --> : copying to clipboard agent_x91 10-05-2004, 08:32 AM how can java be used to copy a string to the clipboard, and paste from the clipboard? thanks buntine 10-06-2004, 02:24 AM What are you using to perform the cut and copy operations? In a JTextArea, you can simply use the cut(), copy(), and paste() methods from JTextComponent JTextArea txtArea = new JTextArea(); ... txtArea.copy(); // Copy the currently selected range to the clipboard. txtArea.paste(); // Paste the clipboard. Regards. agent_x91 10-06-2004, 08:27 AM well i'm not using anything to perform the cut and copy operations, I don't know how to. is here any way of just storing something on the clipboard or extract something from it without creatign a JTextArea? Is it possible to open a stream to the clipboard? Thanks in advance. buntine 10-06-2004, 11:59 AM You may be able to sue the Transferable interface to store and retreive data in the system clipboard. It would be more efficient to simply use a Database or textfile, thuogh. Take a look at the Clipboard class at the Java docs: http://java.sun.com/j2se/1.3/docs/api/java/awt/datatransfer/Clipboard.html The following small examples also demonstrate how to use the clipboard with Java. - http://www.rgagnon.com/javadetails/java-0382.html - http://java.sun.com/j2se/1.4.2/docs/api/java/awt/datatransfer/class-use/Clipboard.html Regards. agent_x91 10-06-2004, 02:57 PM the Clipboard object is exactly what I was looking for. thanks. webdeveloper.com
Copyright WebMediaBrands Inc., All Rights Reserved. |