日期:2014-05-20 浏览次数:20701 次
public class myj2me extends MIDlet { Display display.....//初始化过程略去 //构造函数中 canvas1 can1 = new canvas1(this); canvas2 can1 = new canvas2(this); public void startApp(){display.setCurrent(can1);} public void setcanvas1(){display.setCurrent(can1);} public void setcanvas2(){display.setCurrent(can2);} } class canvas1 extends Canvas implements CommandListener { myj2me j2me; public canvas1(myj2me my_j2me) { j2me = my_j2me; } public void commandAction(Command cmd,Displayable dis){ if(cmd==...){ j2me.setcanvas2(); } } } class canvas2 extends Canvas implements CommandListener { myj2me j2me; public canvas2(myj2me my_j2me) { j2me = my_j2me; } public void commandAction(Command cmd,Displayable dis){ if(cmd==...){ j2me.setcanvas3(); } } }