aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to disable copy and paste in a JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to disable copy and paste in a JTextField " Watch "How to disable copy and paste in a JTextField " New topic
Author

How to disable copy and paste in a JTextField

Jeff Chang
Greenhorn

Joined: Aug 23, 2001
Posts: 23
hi,
I want to disable the copy and paste in a JTextField. How to do this because these functionalities are default. Thanks for any advice.
Jeff
Vinod Venugopal
Ranch Hand

Joined: Dec 06, 2000
Posts: 148
Du have any further specs b'cos obviously making setEnabled(false) would do?
Or you could use your own Document manager to disable copy paste actions.


- Vinod<br />-------<br />SCJP2
Jeff Chang
Greenhorn

Joined: Aug 23, 2001
Posts: 23
It works now.
I overrided the copy() and paste() methods such as:
{
....
public void copy() {}
public void paste() {}
}
Jeff
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to disable copy and paste in a JTextField