从 JTextField 中失去焦点
在我使用文本字段后,我无法获得一个 jpanel,单击该面板可以让我的按键侦听器重新回到焦点。它适用于鼠标侦听器,但所有其他击键都会由文本字段而不是 jpanel 检测到。
该面板已设置Focusable(true)并且工作正常,直到我为文本字段提供键盘焦点。就像文本字段不会释放焦点一样。
有什么建议吗?
After I use my textfield I can't get a jpanel that click on back into focus for my keylistener. It works for the mouselistener but all other keystrokes keep being detected by the textfield not the jpanel.
The panel has been setFocusable(true) and works fine until i give the textfield the keyboard focus. It's like the textfield won't release the focus.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案是在执行文本操作后调用面板上的 requestFocus()
The answer was to call requestFocus() on the panel after the text action was performed