如何在J2ME移动应用程序的画布上显示对话框?

编程入门 行业动态 更新时间:2024-10-27 17:21:08
本文介绍了如何在J2ME移动应用程序的画布上显示对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

可能重复: 是否可以在无线工具包2.5.2中使用带有javax.microedition.lcdui.Canvas的lwuit.Dialog吗?

Possible Duplicate: Is this possible to use lwuit.Dialog with javax.microedition.lcdui.Canvas in wireless toolkit 2.5.2?

我创建了一个画布,当我按下移动键时可以写内容(例如,如果我按下"A",它将使用绘画功能将其写在屏幕上).现在,当我从移动设备上按任意键时,我想显示一个对话框或弹出窗口.使用Canvas时是否可以显示对话框?

I created a canvas to write contents when I press mobile keys(for Example if I press "A" it will be written on the screen using paint function). Now I want to show a dialog or PopUp window when I press any key from mobile. Is it possible to show dialog when am using Canvas?

举个例子,

public class Mycanvas extends Canvas implement ActionListener { Dialog dialog=new Dialog(); }

推荐答案

好的,我认为您必须这样做. LWUIT中正确的方法是使用Dialog.

Ok, I think you must do that. The right thing in LWUIT is using Dialog.

使用new创建一个Dialog.即Dialog d = new Dialog()

下一步是用Dialog.setTitle(String text)填充标题和正文,或者在Dialog的版式中放入一些内容.

The next step is filling the title and body with Dialog.setTitle(String text) or putting something inside the Dialog's layout.

当准备显示Dialog时,必须调用Dialog.show(),要删除它,请调用Dialog.dispose()

When your Dialog is ready to be shown, you must call to Dialog.show() and when you want to remove it, call to Dialog.dispose()

在这里看看

是是否可以在无线工具包2.5.2中将lwuit.Dialog与javax.microedition.lcdui.Canvas一起使用?

更多推荐

如何在J2ME移动应用程序的画布上显示对话框?

本文发布于:2023-11-27 23:49:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640102.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:画布   对话框   应用程序   如何在   J2ME

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!