如何在J2ME移动应用程序的画布上显示对话框? [英] How can I show dialog box on canvas in J2ME mobile application?
问题描述
可能重复:
是否可以在无线工具包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移动应用程序的画布上显示对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!