⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycanvas.java

📁 J2ME 无线通信技术应用开发源代码
💻 JAVA
字号:
// 程序名MyCanvas.java
// 一个简单的Canvas的子类
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyCanvas extends Canvas {
  private UI_Low1 midlet;

  public MyCanvas( UI_Low1 midlet ){
    this.midlet = midlet;
  } 
 
  protected void showNotify() {
    System.out.println("Method showNotify() called.");
    System.out.println("isShown() : "+isShown());
  }
  
  protected void hideNotify() {
    System.out.println("Method hideNotify() called.");
    System.out.println("isShown() : "+isShown());
  }

  protected void paint( Graphics g ){
    System.out.println("Method paint() started.");
    System.out.println("isShown() : "+isShown());
    g.setColor(0x0000ff);
    g.fillRect( 0, 0, getWidth(), getHeight());
    System.out.println("Method paint() returned.");
    System.out.println("isShown() : "+isShown());
  }

  protected void keyPressed( int keyCode ){
    System.out.println("key pressed.");
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -