使用draw2d和swt处理按键
每个 org.eclipse.draw2d.Figure 类都有 addKeyListener() 方法。但当按键按下时,并不是每个人物都能处理它。什么样的人物处理关键事件?
谢谢。
Every org.eclipse.draw2d.Figure class has addKeyListener() method. But when key presses not every Figure handle it. What kind of figure handles key-events?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯。我不知道真正的答案。但作为变体 - 将侦听器添加到 Shell 并以某种特定方式处理它。
Hm. I don't know real answer. But as variant - add listener to Shell and handle it in some specific way.
答案是“当前有焦点的人物”。 - 否则每次你按下一个键时,你的所有人物都会收到
KeyEvent
并且必须处理它。我建议这不太可能是你想要的。The answer is "whichever Figure currently has focus." - otherwise every time you pressed a key, all of your figures would receive the
KeyEvent
and have to handle it. I'd suggest that's unlikely to be what you want.