騎豬闖天下

          J2ME隨筆,記錄成長的腳步

          統(tǒng)計

          留言簿(3)

          閱讀排行榜

          評論排行榜

          [J2ME-原創(chuàng)]錨點定位和值

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



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


          2. 參數(shù)“vcenter”為圖片專用——這個錨點示意圖是以“Image”為例的,當要畫的是“String”時,定位參數(shù)“vcenter”非法;
          3. 定位坐標為 兩個參數(shù)一組,每組為一個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);

          打印結(jié)果為:
          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 騎豬闖天下 閱讀(877) 評論(0)  編輯  收藏


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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 和林格尔县| 隆安县| 永春县| 新兴县| 汨罗市| 河北省| 夏邑县| 湖北省| 桂阳县| 通化县| 阳曲县| 黑山县| 卓资县| 肃宁县| 丹寨县| 江北区| 贵溪市| 龙胜| 巴南区| 松滋市| 长子县| 稻城县| 哈尔滨市| 岫岩| 隆回县| 东城区| 汝州市| 岑巩县| 余江县| 泸西县| 花莲市| 固镇县| 隆安县| 堆龙德庆县| 芜湖县| 昌图县| 东乌珠穆沁旗| 淮阳县| 平邑县| 田东县| 名山县|