Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating a Key Event on a Component  RSS feed

 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using a Toch Screen application that has multiple JPanels. One of the Panels has a button for a BackSpace Function. When a TextComponent has Focus, and the User presses the BackSpace Button, I want to invoke a KeyEvent for a KeyPressed or KeyTyped for the BackSpace. I have tried creating a KeyEvent, but I haven't had any luck. Can some one help me with this, I am stuck. Thanks, Jeff
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,
You are in luck! I was trying to figure this out for about 2 months. I just created a class that can be used to fake any AWT event! Without further ado:

Just have your code call the method above:

It really works!!
Enjoy,
Manfred.
 
Jeff Holmes
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help, I was really hitting the wall on this one. It is greatly appreciated.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!