Take a look at the Clipboard class (java.awt.datatransfer package). You can
obtain the object by calling:

Clipboard clipboard  = Toolkit.getDefaultToolkit().getSystemClipboard();

then you can pass your data to the clipboard (get text from your text
fields, apply any logic that you see appropriate):

String text = tf1.getText + tf2.getText() + .... + ; // get text from all
your components
StringSelection data = new StringSelection( text );
clipboard.setContents(data, null);


Now when the user does Ctrl+V, the data from the clipboard will be pasted.

Does this help?

-------------------------
Lenny Reinstein
Goldman, Sachs & Co.
New York

-----Original Message-----
From: Samivelu, Srinivasan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 3:21 AM
To: '[EMAIL PROTECTED]'
Subject: Passing custom text to clipboard - Urgent


Dear All

        I have ten textfields in a JPanel. When the user selects any text
from the any of the text fields, and presses Ctrl+C , I have to select the
texts in all the fields and pass it to the clipboard.
        Can anybody suggest me how to go about with this. 
wbr,
Srini


_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to