• Post Reply Bookmark Topic Watch Topic
  • New Topic

Enter key event in Swing  RSS feed

 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi,

I was doing some experiment with my console earlier I asked about now I observed following thing.I have created my own CustomKeyListener a subclass of KeyAdapter I have overriden keyPressed method.Now I have put a condition like getKeyCode==VK_ENTER to listen to enter key.Now my question is I have kept the body of if block empty but still on hitting enter key caret is moving down to the next line.

Regards,
Arka
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't add your custom keylistener class.
What happens now? does it still go to the
next line?

If so, you need to look into the source
code for the reason why [enter] goes to
the next line.

hint: keybindings
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!