This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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


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
 
Consider Paul's rocket mass heater.
 
subject: How to disable copy and paste in a JTextField