java blog

          java boy

          常用鏈接

          統計

          最新評論

          javaME 線與弧形

           

          import javax.microedition.lcdui.*;
          import javax.microedition.midlet.*;


          public class GraphicsTest extends MIDlet{
            private Display display;

              public GraphicsTest() {
                  display=Display.getDisplay(this);

              }
           
              protected void destroyApp(boolean unconditional)  {
               
                 
              }

              protected void pauseApp() {
                 
              }

              protected void startApp(){
               MyCanvas mc=new MyCanvas();
               display.setCurrent(mc);
              }


          }
          class MyCanvas extends Canvas {

              public void paint(Graphics g){
               int width=getWidth();
               int height=getHeight();
              
               g.setColor(0);
               g.fillRect(0, 0, width, height);
              
               int a=width/5;
               int b=height/5;
               g.setColor(0Xffff00);
               for(int i=1;i<=4;i++){
               g.drawLine(a,0 ,a,height);
               g.drawLine( 0,b,  width,b);
               a=a+width/5;
               b=b+height/5;
              
               } g.drawArc(0, 0, width, height, 0, 360);
              }

          }

           

          posted on 2009-12-01 20:01 javaz 閱讀(168) 評論(0)  編輯  收藏 所屬分類: javaME


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


          網站導航:
           
          主站蜘蛛池模板: 哈巴河县| 鸡西市| 年辖:市辖区| 万安县| 河东区| 新安县| 无极县| 菏泽市| 达尔| 溆浦县| 阳西县| 康乐县| 固阳县| 普陀区| 五河县| 通榆县| 遂昌县| 土默特右旗| 吴川市| 大悟县| 静安区| 徐州市| 噶尔县| 孟州市| 青阳县| 清原| 炎陵县| 深州市| 安化县| 大同县| 江北区| 宁明县| 绥棱县| 嘉黎县| 宿松县| 邹平县| 康乐县| 晋州市| 四子王旗| 定远县| 周宁县|