commandTestCanvas.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- package commandTest;
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.*;
- import java.io.*;
- public class commandTestCanvas extends Canvas
- {
- private Command backCmd = new Command("后退", Command.SCREEN, 1);
- public commandTestCanvas()
- {
- System.out.println(getHeight());
- setFullScreenMode(true);
- System.out.println(getHeight());
- }
- public void paint(Graphics g)
- { int width=this.getWidth();
- int height=this.getHeight();
- g.setColor(0xFFFFFF);
- g.fillRect(0,0,width,height);
- }
- protected void keyPressed(int keyCode){
- System.out.println("键盘"+getKeyName(keyCode)+"被按下,值为"+keyCode);
- }
- protected void keyReleased(int keyCode){
- System.out.println("键盘"+getKeyName(keyCode)+"释放");
- }
- protected void keyRepeated(int keyCode){
- System.out.println("键盘"+getKeyName(keyCode)+"被持续按下");
- }
- }