This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to restrict ctrl+c, ctrl+v, ctrl+x

 
Subbarao Kondabala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my text field I want to restrict ctrl+c, ctrl+v, ctrl+x. How can I do this in swings.

Please help me

Thanks in advance

Subbarao Kondabala
 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A text field can be disabled. Swing (not swings) provides the capability to sense keyboard events.
Putting these two facts together, how do you think this particular problem should be approached?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> In my text field I want to restrict ctrl+c, ctrl+v, ctrl+x. How can I do this in swings.

the simple way is to override cut() copy() paste(), to do nothing
 
Rob Camick
Ranch Hand
Posts: 2612
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the Key Bindings from the InputMap.

 
Maneesh Godbole
Saloon Keeper
Posts: 11092
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:
the simple way is to override cut() copy() paste(), to do nothing


I was not even aware of these methods!!! Guess I need to go back to school. Doh!
 
Subbarao Kondabala
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much Michael

It got worked

Once again thank you so much


Subbarao kondabala

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic