關(guān) 閉

        新聞中心

        EEPW首頁 > 工控自動化 > 設(shè)計應(yīng)用 > 使用J2ME技術(shù)實現(xiàn)手機觸摸屏開發(fā)的方法

        使用J2ME技術(shù)實現(xiàn)手機觸摸屏開發(fā)的方法

        作者: 時間:2008-08-21 來源:網(wǎng)絡(luò) 收藏

          在目錄下的22wtklibdevicesDefaultColorPhoneDefaultColorPhone.properties的文件中有一行touch_screen=false,把它改成true。

          MIDP2.0對于方法有三個:

          1.poerDragged( x, y) 拖拽事件(暫時還沒研究)

          2.pointerPressed(int x, int y) 按壓

          3.pointerReleased(int x, int y) 觸摸屏釋放

          pointerPressed(int x, int y)當用戶按下觸摸屏的時候會自動調(diào)用這個方法x,y就是當前壓下的坐標

          pointerReleased(int x, int y)和pointerPressed(int x, int y)類似相應(yīng)觸摸屏釋放事件

          這里,我只是以相應(yīng)左右軟鍵及菜單事件處理為例:

          protected void pointerPressed(int x, int y) {

          switch (status) {

          case .S_MENU:

          int menuWidth = 90;

          int = 17;

          int = 16;

          int = 10;

          if (x menuWidth y >(

           - ( * + ))) {

          int menuIndex = (y - ( - (

           * + ))) / menuItemHeight;

          doMenuOK(menuIndex);

          }

          case .S_DRAW_DIBIAO_LIST:

          case .S_LOCAL_SEARCH_RESULT:

          case Consts.S_MAP_VIEW:

          // 左右軟鍵40*20的區(qū)域

          if (x 40 y >( - 20)) {

          doCommandLeft();

          }

          if (x >(screenWidth - 40) y >(screenHeight - 20)) {

          doCommandRight();

          }

          break;

          }

          }



        評論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 通山县| 大冶市| 泸水县| 景洪市| 新乐市| 科技| 江源县| 莱西市| 仁怀市| 垣曲县| 息烽县| 江达县| 云梦县| 新津县| 邯郸县| 茂名市| 阿鲁科尔沁旗| 藁城市| 金溪县| 郑州市| 迁安市| 秭归县| 阿巴嘎旗| 大石桥市| 红河县| 宜兰市| 虞城县| 普定县| 永仁县| 涟水县| 习水县| 莒南县| 大关县| 达日县| 汾西县| 江达县| 台前县| 上林县| 博罗县| 昌都县| 宝山区|