• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to stop copying text from textArea

 
kieran pattni
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all...how do you stop say text being highlighted from textArea and copied somewhere else...i am doing spelling game..where the word dispears after three seconds and you have to type the word in another textArea..thank you
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to do it is override the getSelectedText() to return null.
 
Darryl Burke
Bartender
Posts: 5154
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's wrong with keeping it simple and using a JLabel?

Note that nothing you do can prevent the user from taking a screenshot.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There might be formatting issues in using a JLabel as the OP mentioned a text area.
 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kieran pattni:
how do you stop say text being highlighted from textArea and copied somewhere else...i am doing spelling game..where the word dispears after three seconds and you have to type the word in another textArea..


There are several ways this can be done. One way is to override the copy() method, for example:This prevents the "copied somewhere else" part but not the "text being highlighted" part.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!