Search code examples
javajava-melwuitlcdui

How can I show dialog box on canvas in J2ME mobile application?


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

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?

say some example,

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

     }

Solution

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

    Create a Dialog using new. i.e. Dialog d = new Dialog()

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

    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()

    Take a look here

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