騎豬闖天下

          J2ME隨筆,記錄成長的腳步

          統計

          留言簿(3)

          閱讀排行榜

          評論排行榜

          [J2ME-原創]錨點定位和值

          J2ME畫圖,以錨點定位,各錨點位置示意圖如下:



          說明:
          1. 通過測試驗證:
           g.drawString("文字", x, y, 0); 
           =  
          g.drawString("文字", x, y, Graphics.LEFT | Graphics.TOP);
          0是個默認值,默認的意思就是默認手機空屏時,第一個點可以正常顯示的位置,即:Graphics.LEFT | Graphics.TOP


          2. 參數“vcenter”為圖片專用——這個錨點示意圖是以“Image”為例的,當要畫的是“String”時,定位參數“vcenter”非法;
          3. 定位坐標為 兩個參數一組,每組為一個int值,具體的值如下所列;
                  int a = Graphics.LEFT | Graphics.TOP;
                  
          int b = Graphics.LEFT |
           Graphics.BASELINE;
                  
          int c = Graphics.LEFT |
           Graphics.VCENTER;
                  
          int d = Graphics.LEFT |
           Graphics.BOTTOM;
                  
                  
          int e = Graphics.RIGHT |
           Graphics.TOP;
                  
          int f = Graphics.RIGHT |
           Graphics.BASELINE;
                  
          int g = Graphics.RIGHT |
           Graphics.VCENTER;
                  
          int h = Graphics.RIGHT |
           Graphics.BOTTOM;
                  
                  
          int i = Graphics.HCENTER |
           Graphics.TOP;
                  
          int j = Graphics.HCENTER |
           Graphics.BASELINE;
                  
          int k = Graphics.HCENTER |
           Graphics.VCENTER;
                  
          int l = Graphics.HCENTER |
           Graphics.BOTTOM;
                  
                  System.out.println(
          "a is : "+
          a);
                  System.out.println(
          "b is : "+
          b);
                  System.out.println(
          "c is : "+
          c);
                  System.out.println(
          "d is : "+
          d);
                  
                  System.out.println(
          "e is : "+
          e);
                  System.out.println(
          "f is : "+
          f);
                  System.out.println(
          "g is : "+
          g);
                  System.out.println(
          "h is : "+
          h);
                  
                  System.out.println(
          "i is : "+
          i);
                  System.out.println(
          "j is : "+
          j);
                  System.out.println(
          "k is : "+
          k);
                  System.out.println(
          "l is : "+l);

          打印結果為:
          a is : 20
          b is : 68
          c is : 6
          d is : 36
          e is : 24
          f is : 72
          g is : 10
          h is : 40
          i is : 17
          j is : 65
          k is : 3
          l is : 33

          --End--

          posted on 2010-03-05 14:47 騎豬闖天下 閱讀(874) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 衡水市| 北川| 绿春县| 临猗县| 措勤县| 定西市| 寿宁县| 高唐县| 云梦县| 烟台市| 遂昌县| 颍上县| 扎鲁特旗| 大石桥市| 民丰县| 扶风县| 孙吴县| 正镶白旗| 民和| 孟连| 微山县| 迁西县| 潍坊市| 马边| 洪泽县| 白河县| 保亭| 卢湾区| 都江堰市| 丰宁| 阜新市| 济南市| 惠水县| 旌德县| 玉山县| 舟山市| 桂林市| 安仁县| 乐安县| 曲周县| 伊吾县|