File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Cut/Copy/Paste from JTextField? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Cut/Copy/Paste from JTextField?" Watch "Cut/Copy/Paste from JTextField?" New topic
Author

Cut/Copy/Paste from JTextField?

Matt Hazan
Greenhorn

Joined: Jan 27, 2011
Posts: 29
Hello,
I am fairly new to Java programming and I was wondering if someone can help me figure out how to use the JTextComponent cut(), paste(), etc... tools.

My program has text fields that appear in a JFrame... I also have an Edit menu where the user could copy, paste, and cut the text in the selected text in the textfield area.

What I tried to do is simply use myField.cut(); (which should work, i think), However, this does not work. I am not getting an error or a warning, it compiles and runs fine, however when I try to cut the text in the program it does not respond, the text remains as if I never tried to 'cut'.


Any help will be greatly appreciated!

Thanks in advance!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

To get better help sooner, post an SSCCE that demonstrates the problem.


luck, db
There are no new questions, but there may be new answers.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2153
    
    7
The section from the Swing tutorial on Text Component Features shows you how to implement copy/cut/paste using the Actions defined in the Editor Kit.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cut/Copy/Paste from JTextField?
 
Similar Threads
Cut,copy and paste
addMouseListener to JFrame
cut copy and paste functions
cut copy paste
JMenuItems tricks for displaying short cut text