• Post Reply Bookmark Topic Watch Topic
  • New Topic

KeyListener multiple event generation

 
Sunny Mattas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I am using KeyListener in my swing application.I have implemented the keyPressed(KeyEvent ev) method.
Part of my code is



110 represents the Del key in num pad.When pressing the Del key it is not giving me the inconsistent behavior.Most of time when I am pressing the Del key , it seems kepPressed is called multiple times.Gives output

allstatus
bfhfj1
allstatus
bfhfj1
//may repeat more times depending on data present on JButton


Please help me with this

Regards
Sunny Mattas
SCJP5

 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried this with key bindings which often is the way to handle keystrokes in a Swing app? If this doesn't help and you don't get other suggestions that help, I would suggest that you create and post a small app that is compilable, runnable, and that demonstrates your current problem. This app would have none of your program logic and all of your program's problem.

Best of luck.
 
Sunny Mattas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried this with key bindings which often is the way to handle keystrokes in a Swing app


No I haven't .OK I will study this key bindings concept and use it. Then I will let you know.

Thanks

Sunny Mattas
SCJP5
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!