Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Cut,Copy,Paste

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic