notifyDemo.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.midlet.*;
- import javax.microedition.lcdui.*;
- public class notifyDemo extends MIDlet {
- private Display display;
- public notifyDemo() {
- display=Display.getDisplay(this);
- }
- public void startApp() throws MIDletStateChangeException {
- display.setCurrent(new notifyDemoCanvas());
- }
- public void pauseApp() {
- }
- public void destroyApp(boolean unconditional) {
- }
- class notifyDemoCanvas extends Canvas {
- int width, height;
- int deltaX, deltaY;
- int x,y;
- public notifyDemoCanvas() {
- width = getWidth();
- height = getHeight();
- }
- public void paint(Graphics g) {
- System.out.println("this is paint");
- System.out.println("canvas is shown?"+isShown());
- g.setColor(0xFFFFFF);
- g.fillRect(0,0,width,height);
- }
- protected void showNotify(){
- System.out.println("this is showNotify");
- System.out.println("canvas is shown?"+isShown());
- }
- protected void hideNotify(){
- System.out.println("this is hideNotify");
- System.out.println("canvas is shown?"+isShown());
- }
- }
- }