Dear friends,
My name is Theodoros Tsioupros and I am a university student from
Greece. It is the first time I am using a newsgroup and I am writing
to request your precious help with a simple question about Java.
I would like you to give me a simple routine, so as to be able to
paste text from the system clipboard into a text area.
*** Earnest request ***
I would appreciate it very much if you could send a copy of your
answer to my E-mail address ( tsioupros@softhome.net ), because I do
not have Usenet access all the time.
Looking forward to hearing from you,
Regards to all,
Theodoros Tsioupros ( tsioupros@softhome.net )
Christophe Vanfleteren - 05 May 2004 21:42 GMT
> Dear friends,
>
[quoted text clipped - 3 lines]
> I would like you to give me a simple routine, so as to be able to
> paste text from the system clipboard into a text area.
Since you're a newbie, I'm going to give you some newsgroup tips:
Please don't multi-post (that is, asking the same question in different
newsgroups). It is frowned upon, and contraproductive as to getting
answers.
Use normal sentences for your subjects. Yours was good, except the *** in
the front and back. I also don't know where the Msgid thingy comes from,
but if it comes from your side, get rid of it.
Do not ask for reply by email. Even if you don't always have access to a
news server, you can still use groups.google.com.
Also read http://www.physci.org/codes/javafaq.jsp#gen and
http://mindprod.com/jgloss/newsgroups.html

Signature
Kind regards,
Christophe Vanfleteren
Peter Kirk - 06 May 2004 10:04 GMT
> I would like you to give me a simple routine, so as to be able to
> paste text from the system clipboard into a text area.
I have no idea how to do this, but these might help get you started:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/datatransfer/Clipboard.html
http://javaalmanac.com/egs/java.awt.datatransfer/ToClip.html
http://www.javaworld.com/javaworld/javatips/jw-javatip61.html
Peter
Fahd Shariff - 07 May 2004 11:58 GMT
How about paste() ?
Always consult the API:
Class JTextComponent
public void paste()
Transfers the contents of the system clipboard into the associated
text model. If there is a selection in the associated view, it is
replaced with the contents of the clipboard. If there is no selection,
the clipboard contents are inserted in front of the current insert
position in the associated view. If the clipboard is empty, does
nothing.
Therefore you would use: myTextArea.paste() ;
There are similar methods for cut and copy as well.
Fahd Shariff
http://www.fahdshariff.cjb.net