我可以在应用程序中同时使用画布和表单吗
我可以在应用程序中同时使用 Canvas 和 form 吗?如果是,那么我如何从 Canvas 访问表单?
Can I use Canvas and form together in application? If yes then how can I access form from Canvas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,您可以同时使用两者,但不能同时使用。您可以使用
Display.setCurrent()
。Yes you can use both but not at the same time. You can switch between them by using
Display.setCurrent()
.您需要 Midlet 来找到其显示(和表单)。您需要将 MIDlet 的引用发送到画布构造函数。因此您的画布将如下所示:
其中“myMIDlet”是您的 MIDlet 的名称。
在您的 MIDlet 中:
当您想要从“myCanvas”访问表单(可能在画布的 commandAction 或 keyPressed 方法中)时,请执行以下操作:
参考:
代码项目
You need your Midlet to find its display (and the form).You would to send a reference of your MIDlet to the canvas constructor.So your canvas would be look like this:
Where "myMIDlet" is name of your MIDlet.
In your MIDlet:
When you want to got to the form from "myCanvas" (probably in a commandAction or keyPressed methods of your canvas) do this:
Reference:
codeproject
您可以将表单切换为画布。例如:
但是,在 Canvas to Form 中,我不知道。
You can switch form to canvas. For example:
But, in Canvas to Form, I don't know.