aspose file tools
The moose likes Swing / AWT / SWT / JFace and the fly likes Cut,Copy,Paste Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "Cut,Copy,Paste" Watch "Cut,Copy,Paste" New topic
Author

Cut,Copy,Paste

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
The following is an example of how to copy and paste...

I have also noticed that the JTextComponent package has methods for cut, copy, and paste.
What is the difference between the two?
Why would I want to add all of the above code if I can just call the cut() method on my JTextField?
I'm a bit
Still new at this. Thanks in advance!!


[This message has been edited by Jennifer Sohl (edited September 10, 2001).]
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
I just use the cut(), copy(), paste() provided by Java in a couple of my apps and have never had any problems with the method. I personally wouldn't bother using all that other code!
regards,
Ben.


SCJP 1.4, www.gsi3d.org.uk
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Thanks for the reply! Now, since I know I can use the methods provided, I have another question. I have an application with numerous JTextFields. How do I tell it I want to paste the contents of the clipboard to a certain Field? I can call a paste method on all of the fields, but then the text goes into all of the fields.
I guess I need to know how to condition the paste method to put the copied text in a certain place.
Any suggestions?
Thanks in advance!!!
 
IntelliJ Java IDE
 
subject: Cut,Copy,Paste
 
Threads others viewed
JTextArea setSelection not highliting
Java Application on Citrix
Clipboard problem
Clipboard paradox
Strange behavior
MyEclipse, The Clear Choice