騎豬闖天下

          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)航:
           
          主站蜘蛛池模板: 乃东县| 宜昌市| 枣阳市| 红原县| 黄龙县| 富阳市| 泊头市| 秦皇岛市| 尖扎县| 漳平市| 台中县| 多伦县| 涪陵区| 城固县| 乌苏市| 巩留县| 台中县| 内黄县| 林州市| 左云县| 通海县| 彰化县| 益阳市| 金华市| 汉沽区| 靖边县| 漯河市| 顺义区| 阿拉尔市| 阳谷县| 台中市| 万州区| 金塔县| 吉水县| 鹤岗市| 察雅县| 绥芬河市| 高要市| 嘉兴市| 内江市| 中超|