如何在 J2ME 上 GameCanvas 和 LCDUI 元素之间进行交互?
问题是我编写了一个 J2ME 程序,首先使用图形界面(GameCanvas)显示一个“菜单”,当用户选择一个项目时,我需要设置当前该项目(例如列表),但是当从列表返回时(这可能是因为用户按下命令“菜单”项)我需要再次显示菜单。
真正的问题是,当菜单再次显示时,gamecanvas 对象的 keyPressed() 侦听器停止工作。
基本上我有:
一个 Midlet 对象,其中:
- GameCanvas 对象实例
- 一个 List 对象实例
我不明白它是如何工作的,我没有找到在一个 Midlet 上共享低级和高级图形级 API 的教程。
The thing is I writing a J2ME program that fisrt of all show a "menu" using graphics interface (GameCanvas) and when the user select one item, I need to setCurrent that item (ex. a List), but when return from the List (it could be because the user push a Command "Menu" Item) I need to show the menu again.
The real problem when the menu show again, the keyPressed() listener of gamecanvas object stop working.
Basically I have:
A Midlet object with:
- GameCanvas object instance
- A List object instance
I don't understand how that works, I didn't find tutorial that share low and high graphics-level APIs on one Midlet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能否分享一个重现此问题的完整代码,我想不出任何可以阻止侦听器再次工作的原因。
我不建议在同一个应用程序中混合低级和高级 UI,这会破坏应用程序 UI 的一致性。
could you please share a fully code that reproduce this problem, I can't think of any reason that could stop the listener from working again.
I don't recommend mixing low-level and high-level UI in the same application, it will break the consistency of your application UI.