đây là code cùa mình
lớp newclass
Mã:
import javax.microedition.lcdui.Display;import javax.microedition.midlet.MIDlet;import javax.microedition.midlet.*;import javax.microedition.lcdui.*; public class NewClass extends MIDlet { private Display display; public MyCanvans canvans; public NewClass () { display= Display.getDisplay(this); canvans=new MyCanvans(null); } public void startApp() { display.setCurrent(canvans); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void Exit() { destroyApp(true); notifyDestroyed(); } }
đấy là code MyCanvans
Mã:
import javax.microedition.lcdui.Canvas;import javax.microedition.lcdui.Command;import javax.microedition.lcdui.CommandListener;import javax.microedition.lcdui.Displayable;import javax.microedition.lcdui.Graphics; public class MyCanvans extends Canvas implements CommandListener{private Command exit;private NewClass filledRectangleExample;public MyCanvans(NewClass filledRectangleExample){ this.filledRectangleExample=filledRectangleExample; exit=new Command("Exit",Command.EXIT,1); addCommand(exit); setCommandListener(this);} protected void paint(Graphics g) { //throw new UnsupportedOperationException("Not supported yet."); g.setColor(255,255,255); g.fillRect(0,0,getWidth(),getHeight()); g.setColor(0,0,255); g.fillRect(50,50,60, 40); } public void commandAction(Command c, Displayable d) { // throw new UnsupportedOperationException("Not supported yet."); if(c==exit) { filledRectangleExample.Exit(); } } }
bạn nào biết sửa giúp mình thaks
View more random threads:
Pallet nhựa Lâm Đồng giải pháp hoàn hảo cho nhà kho Pallet nhựa Lâm Đồng là một giải pháp đa năng và hiệu quả trong việc vận chuyển và lưu trữ hàng hóa. Trong đó, pallet nhựa Lâm Đồng không chỉ đáp...
Pallet nhựa Lâm Đồng giải pháp...