·¢ÐÅÈË: jtiger (jim), ÐÅÇø: Java 
±ê  Ìâ: ÔÚJAVA appletÖе͝»­(Èý) 
ÈÕ  ÆÚ: Tue Mar 12 17:03:29 1996 
 
         
        Ë«»º³å¼¼Êõ£º 
                ÁíÒ»ÖÖ¼õС֮֡¼äµÄÉÁ˸µÄ·½·¨ÊÇʹÓÃË«»º³å,ËüÔÚÐí¶à¶¯»­applet 
        Öб»Ê¹Óᣠ
                Ö÷ÒªÔ­ÀíÊÇ´´½¨Ò»¸öºǫ́ͼÏó,½«Ò»Ö¡»­ÈëͼÏó,È»ºóµ÷ÓÃdrawImage() 
        ½«Õû¸öͼÏóÒ»´Î»­µ½ÆÁÄ»ÉÏÈ¥¡£ºÃ´¦ÊǴ󲿷ֻæÖÆÊÇÀëÆÁµÄ¡£½«ÀëÆÁͼÏóÒ»´Î 
        »æÖÁÆÁÄ»ÉϱÈÖ±½ÓÔÚÆÁÄ»ÉÏ»æÖÆÒªÓÐЧµÃ¶à¡£ 
                Ë«»º³å¿ÉÒÔʹ¶¯»­Æ½»¬,µ«ÓÐÒ»¸öȱµã,Òª·ÖÅäÒ»Õźǫ́ͼÏó,Èç¹ûͼÏó 
        Ï൱´ó,Õ⽫ÐèÒªºÜ´óÒ»¿éÄÚ´æ¡£ 
                µ±ÄãʹÓÃË«»º³å¼¼Êõʱ,Ó¦ÖØÔØupdate()¡£ 
                 
                Dimension offDimension;
                Image offImage; 
                Graphics offGraphics; 
 
                public void update(Graphics g) { 
                        Dimension d = size(); 
 
                        if ((offGraphics == null) 
                         || (d.width != offDimension.width) 
                         || (d.height != offDimension.height)) { 
                                offDimension = d; 
                                offImage = createImage(d.width, d.height); 
                                offGraphics = offImage.getGraphics(); 
                        } 
 
                        offGraphics.setColor(getBackground());
                       offGraphics.fillRect(0, 0, d.width, d.height); 
                        offGraphics.setColor(Color.Black); 
 
                        paintFrame(offGraphics); 
 
                        g.drawImage(offImage, 0, 0, null); 
                } 
 
                public void paint(Graphics g) { 
                        if (offImage != null) { 
                                g.drawImage(offImage, 0, 0, null); 
                        } 
                } 
 
                public void paintFrame(Graphics g) {
                        Dimension d = size(); 
                        int h = d.height / 2; 
                        for (int x = 0; x < d.width; x++) { 
                                int y1 = (int)((1.0 + Math.sin((x - frame) *  
0.05)) + h); 
                                int y2 = (int)((1.0 + Math.sin((x + frame) *  
0.05)) + h); 
                                g.drawLine(x, y1, x, y2); 
                        } 
                } 
 
 
--±àÒë×Ô 

--
   ______
  /  ___/____  _________ _____________ ______ _
  \___ \ _  / / /__  __ \__  ___/_  _ \_  __ `/
    /  / / /_/ / _  / / /_(__  ) /  __// /_/ / 
 /____/  \__,_/  /_/ /_/ /____/  \___/ \__,_/      ÓÄÁé
_______________________________________________________

¡ù À´Ô´:£®ÄÏ´óС°ÙºÏÐÅÏ¢½»»»Õ¾ fbbs.nju.edu.cn£®[FROM: 202.119.36.147]
ÿ