如何检查LUWIT中按下了哪个键?
我正在为我的 j2me 应用程序使用 LWUIT 包。在我的应用程序中,我扩展了 Component 类,然后在组件上绘制字符串。现在我想获取关键代码,然后根据按下的键在组件上绘制字符串。如何做我知道 LWUIT 中按下了哪个键?我想在 LWUIT 上捕获按键事件并在屏幕上绘制字符串。这在 LWUIT 中可能吗?
有没有办法在 LWUIT 中不使用组件的情况下在屏幕上绘制字符串?
I am using LWUIT package for my j2me application.In my application, i have extends Component class and then draw strings on the component.Now i want to get the key code and then draw string on the component based on the key pressed.how do i know which key is pressed in LWUIT? I want to capture key press event on LWUIT and draw strings on screen.Is this possible in LWUIT?
Is there any way to draw strings on screen without using Component in LWUIT?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以向容器添加标签,这通常是我们在 LWUIT 中执行操作并使用基于组件的 UI 的方式(请参阅我们的演示)。
您可以覆盖 keyReleased 并在那里进行事件处理,但您的组件需要可聚焦才能接收关键事件。或者,您可以将键侦听器绑定到表单或覆盖表单键回调方法。
You can add a label to a container which is normally how we do things in LWUIT and use the component based UI (see our demos).
You can override keyReleased and do your event handling there, but your component needs to be focusable to receive key events. Alternatively you can bind a key listener to the form or override the forms key callback methods.