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

百般思念 提交于 2019-12-02 14:15:00

问题


I am using javax.microedition.lcdui.Canvas for drawing my string on the screen. But I also need one dialog window for some purpose. So I am using lwuit package (com.sun.lwuit.Dialog) for showing dialog window when key pressing.

So in my program I just included that package and create the object of the Dialog box. While running my application, it is terminated unexpectedly.

I just included the following lines...

import javax.microedition.lcdui.Canvas;
import com.sun.lwuit.Dialog;

public class Mycanvas extends Canvas implements CommandListener
{
    Dialog dialog = new Dialog();
    //some other remaining codes for my canvas...
}

So, is it possible to show lwuit dialog window with lcdui canvas?


回答1:


I would say it's possible but it will increase size of the app significantly. Whenever you need your dialog you can init LWUIT Display and use LWUIT Forms and Dialogs.

I would better to implement some really simple Dialog ourselves. It's not really much work. Or use another third party solution.




回答2:


My Idea is create an user defined Item which extends from CustomItem for dialog.But it is difficult to code the complete implementation.Better u search for any third pary jar file which already implemented dialog box.



来源:https://stackoverflow.com/questions/8641839/is-this-possible-to-use-lwuit-dialog-with-javax-microedition-lcdui-canvas-in-wir

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!