zoukankan      html  css  js  c++  java
  • J2ME游戏开发之按钮事件

    package com.sliw.graphics;
    
    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Graphics;
    
    public class KeyEventCanvas extends Canvas{
    
        public static final int KEY_UP = -1;
        public static final int KEY_DOWN = -2;
        public static final int KEY_LEFT = -3;
        public static final int KEY_RIGHT = -4;
        public static final  int mkey0 = 48;
        public static final  int mkey1 = 49;
        public static final  int mkey2 = 50;
        public static final  int mkey3 = 51;
        public static final  int mkey4 = 52;    
        public static final  int mkey5 = 53;
        public static final  int mkey6 = 54;
        public static final  int mkey7 = 55;
        public static final  int mkey8 = 56;
        public static final  int mkey9 = 57;
        
        
        
        protected void paint(Graphics arg0) {
            // TODO Auto-generated method stub
            
        }
    
        /**
         *  键按下时的操作
         */
        protected void keyPressed(int keyCode) {
            // TODO Auto-generated method stub
            System.out.println("keyCode=" + keyCode);
            super.keyPressed(keyCode);
        }
        
        /**
         *  按键释放时的操作
         */
        protected void keyReleased(int keyCode) {
            // TODO Auto-generated method stub
            super.keyReleased(keyCode);
        }
    }
    
  • 相关阅读:
    WebConfig配置文件详解
    python标准库介绍——32 Queue 模块详解
    python标准库介绍——31 threading 模块详解
    python标准库介绍——30 code 模块详解
    python标准库介绍——29 zlib 模块详解
    python标准库介绍——28 sha 模块详解
    python标准库介绍——28 md5 模块详解
    python标准库介绍——27 random 模块详解
    python标准库介绍——26 getopt 模块详解
    python标准库介绍——25 errno 模块详解
  • 原文地址:https://www.cnblogs.com/zhangweia/p/2143982.html
Copyright © 2011-2022 走看看