开发者

Prevent keyTyped() from triggering when pressing ctrl+s

开发者 https://www.devze.com 2023-03-08 08:09 出处:网络
I have an accelerator for ctrl+s and at the same time a keylistener on a JTe开发者_JAVA百科xtField listening for keyTyped(). But when i press ctrl+s i dont want it to trigger keyTyped(). Any suggestio

I have an accelerator for ctrl+s and at the same time a keylistener on a JTe开发者_JAVA百科xtField listening for keyTyped(). But when i press ctrl+s i dont want it to trigger keyTyped(). Any suggestions?


Why are you listening for "key typed" events on the text field?

Probably a better solution is to use a DocumentListener to be notified when text is added or removed from the text field.

If you state your actual requirement, not your solution we may be able to give other ideas.


You can consume the event

e.consume();

0

精彩评论

暂无评论...
验证码 换一张
取 消