騎豬闖天下

          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)  編輯  收藏


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


          網站導航:
           
          主站蜘蛛池模板: 宁陵县| 广平县| 泰宁县| 蓬安县| 武鸣县| 新疆| 仁寿县| 古浪县| 蓝田县| 赤城县| 德令哈市| 扶余县| 扶沟县| 杭州市| 太湖县| 化州市| 会同县| 枣庄市| 瑞昌市| 新平| 武山县| 屏南县| 陈巴尔虎旗| 富顺县| 闸北区| 广汉市| 兴和县| 营山县| 刚察县| 普兰店市| 筠连县| 新平| 玉环县| 淳化县| 航空| 孝义市| 乌审旗| 佛学| 庄河市| 张家口市| 承德市|