commandTestCanvas.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package commandTest;
  2. import javax.microedition.lcdui.*;
  3. import javax.microedition.midlet.*;
  4. import java.io.*;
  5. public class commandTestCanvas extends Canvas
  6. {
  7. private Command  backCmd = new Command("后退", Command.SCREEN, 1);
  8. public commandTestCanvas()
  9.         {        
  10.          System.out.println(getHeight());
  11.          setFullScreenMode(true);
  12.          System.out.println(getHeight());
  13.     
  14.         }
  15.         public void paint(Graphics g)
  16.        
  17.         {   int width=this.getWidth();
  18.             int height=this.getHeight();
  19.             g.setColor(0xFFFFFF);
  20.             g.fillRect(0,0,width,height);       
  21.         }
  22.         protected void keyPressed(int keyCode){
  23.         System.out.println("键盘"+getKeyName(keyCode)+"被按下,值为"+keyCode);
  24.         }
  25.         protected void keyReleased(int keyCode){
  26.         System.out.println("键盘"+getKeyName(keyCode)+"释放");
  27.         }
  28.         protected void keyRepeated(int keyCode){
  29.         System.out.println("键盘"+getKeyName(keyCode)+"被持续按下");
  30.         }
  31.      
  32. }