• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 關(guān) 閉

    新聞中心

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

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

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

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

      MIDP2.0對(duì)于方法有三個(gè):

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

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

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

      pointerPressed(int x, int y)當(dāng)用戶按下觸摸屏的時(shí)候會(huì)自動(dòng)調(diào)用這個(gè)方法x,y就是當(dāng)前壓下的坐標(biāo)

      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;

      }

      }



    評(píng)論


    相關(guān)推薦

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

    關(guān)閉
    主站蜘蛛池模板: 开远市| 沐川县| 屏南县| 茌平县| 渭源县| 康定县| 金坛市| 漯河市| 太保市| 辽宁省| 沭阳县| 广宁县| 宜章县| 离岛区| 米林县| 兰考县| 涞水县| 永寿县| 乌鲁木齐县| 同江市| 呈贡县| 玉山县| 石阡县| 青神县| 青浦区| 北票市| 玉环县| 城步| 工布江达县| 南宫市| 吉木萨尔县| 高邑县| 桦川县| 井陉县| 集贤县| 宣武区| 海口市| 德格县| 土默特右旗| 邻水| 黑水县|