java me - In J2ME Using LWUIT library. How to call another Form? -
how call form? when used form.show() method, component of form not displayed.
example...
firstform.java
public class firstform extends midlet implements actionlistener { form frm_first = new form("first"); public command cmd_login; public void startapp() { display.init(this); cmd_login = new command("login"); frm_first.addcomponent(cmd_login); ...... } public void pauseapp() {} public void destroyapp(boolean unconditional) {} public void actionperformed(actionevent ae) { command cmd = ae.getcommand(); string strcmdname = cmd.getcommandname(); if (strcmdname.equals("login")) { //how call login form } } } login.java
public class login extends form implements actionlistener { form frm_login = new form("login"); button btn_login = new button("login"); public login() { .... . .... } }
first have create form in class firstform. form frm=new form("first form"); add command cmd_login in form frm.addcommand(cmd_login); set command listener form frm.setcommandlistener(this); & need implements commandlistener in firstform not actionlistener. in public void commandaction(command c, displayable d) { have write code go second form. & 1 thing noticed in login class, extending class form & creating form object in login class... if using extend class form dont create form object. thanks
Comments
Post a Comment