| ÍøÕ¾Ê×Ò³ | Òµ½çÐÂÎÅ | С×é | Íþ¿Í | È˲Š| ÏÂÔØƵµÀ | ²©¿Í | ´úÂëÌù | ÔÚÏß±à³Ì | ±à³ÌÂÛ̳
»¶Ó­¼ÓÈëÎÒÃÇ£¬Ò»Í¬Çд輼Êõ
Óû§Ãû£º   
 
ÃÜ¡¡Â룺  
¹²ÓÐ 1170 È˹Ø×¢¹ý±¾Ìû
±êÌ⣺ͼƬΪʲô²»ÏÔʾ£¿Ð»Ð»~~
Ö»¿´Â¥Ö÷ ¼ÓÈëÊÕ²Ø
zzxwill
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º398
ר¼Ò·Ö£º0
×¢¡¡²á£º2007-8-15
ÊÕ²Ø
 ÎÊÌâµãÊý£º0 »Ø¸´´ÎÊý£º5 
ͼƬΪʲô²»ÏÔʾ£¿Ð»Ð»~~
package javaDaZuoYe;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
//ͼƬΪʲô²»ÏÔʾ£¿Ð»Ð»~~
public class PlayPic extends Applet implements ActionListener {
    //¶¨ÒåչʾͼƬµÄÊýÁ¿Îª³£Êý10
    final int num=10;
    //¶¨Ò嵱ǰͼƬµÄÐòºÅ
    int cnt;
    Button button1,button2;
    Label label;
    //¶¨ÒåÒ»¸öͼƬÊý×é
    Image[] pic;
    public void init(){
        //³õʼ»¯
        cnt=-1;
        //½«¶ÔÏópicʵÀý»¯
        pic=new Image[num];
        for(int i=0;i<num;i++) {
            pic[i]=getImage(getCodeBase(),"atp"+i+".gif");
        }
        //ÉèÖÃΪ¿Õ²¼¾Ö
        setLayout(null);
        button1=new Button("ÏòÇ°");
        button2=new Button("Ïòºó");
        label=new Label("ÎÒϲ»¶Í¼Æ¬",Label.CENTER);
        //Ìí¼Ó×é¼þ
        add(button1);
        add(button2);
        add(label);
        //É趨×é¼þµÄλÖúʹóС
        label.setBounds(0,0,180,30);
        button1.setBounds(0,240,90,30);
        button2.setBounds(90,240,90,30);
        //Ìí¼Ó°´Å¥µã»÷ʼþµÄ¼àÊÓÆ÷
        button1.addActionListener(this);
        button2.addActionListener(this);   
    }
    public void start() {
    }
    public void stop() {
    }
    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==button1){
            if(cnt>=9) {
                //µ±Í¼Æ¬ÐòºÅ×î´óʱ£¬"ÏòÇ°"°´Å¥²»¿Éµã»÷
                button1.setEnabled(false);
            } else {
                //°´Å¥»Ö¸´Îª¿ÉÒÔµã»÷
                button1.setEnabled(true);
                button2.setEnabled(true);
                //ͼƬÐòºÅµÝÔö
                cnt++;
                //ÖØ»­Ð¡Ó¦ÓóÌÐò
                repaint();
            }
        } else if(e.getSource()==button2){
            if(cnt<=0) {
                //µ±Í¼Æ¬ÐòºÅ×îСʱ£¬"Ïòºó"°´Å¥²»¿Éµã»÷
                button2.setEnabled(false);
            } else {
                //°´Å¥»Ö¸´Îª¿ÉÒÔµã»÷
                button1.setEnabled(true);
                button2.setEnabled(true);
                //ͼƬÐòºÅµÝ¼õ
                cnt--;
                //ÖØ»­Ð¡Ó¦ÓóÌÐò   
                repaint();
            }   
        }
    }
    public void paint(Graphics g) {
        if((pic[cnt])!=null) {
            //½«Í¼Æ¬»­ÔÚСӦÓóÌÐòÉÏ
    g.drawImage(pic[cnt],10,100,pic[cnt].getWidth(this),pic[cnt].getHeight(this),this);
        } else {
            //½«»­±ÊÉèΪºìÉ«
            g.setColor(Color.red);
            g.drawString("Ò»»á¶ù½«Ïò´ó¼Òչʾ×îÐÂͼƬ!!!!",10,100);
        }
    }
}
¸½¼þÖÐÊÇ×ܵÄÎļþ¡£
ÀýÌâ3.rar (98.44 KB)
ËÑË÷¸ü¶àÏà¹ØÖ÷ÌâµÄÌû×Ó: package¡¡public¡¡import¡¡Í¼Æ¬¡¡
2007-12-01 22:48
Starlove
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º169
ר¼Ò·Ö£º0
×¢¡¡²á£º2007-4-26
ÊÕ²Ø
µÃ·Ö:0 
Applet????»¹Ã»ÓÐÑо¿
2007-12-04 07:52
wenbin171
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º119
ר¼Ò·Ö£º0
×¢¡¡²á£º2007-11-6
ÊÕ²Ø
µÃ·Ö:0 
ÎÒÔËÐпÉÒÔÏÔʾͼƬàÞ!

-------ºß!˭˵²»¿ÉÒÔ-------
2007-12-04 10:49
˳×ÓBC
Rank: 1
À´¡¡×Ô£º½­ËÕÐìÖÝ
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º9
ר¼Ò·Ö£º0
×¢¡¡²á£º2007-11-14
ÊÕ²Ø
µÃ·Ö:0 
??
ÓÃswing Ò²¿É°É
IamageIcon
Applet  ÎÒÈ¥¿´¿´APIÎĵµ  ÔÙÀ´ !
ÉÁ£¡
2007-12-05 15:54
²ËÄñÒ²·è¿ñ
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º134
ר¼Ò·Ö£º0
×¢¡¡²á£º2007-3-20
ÊÕ²Ø
µÃ·Ö:0 
ÓÐʱºò¼´Ê¹ÄãµÄ³ÌÐòÊǶԵģ¬ÔÚä¯ÀÀÆ÷ÖÐÒ²²»ÄÜÕý³£ÏÔʾµÄ¡£
Õâ¸úä¯ÀÀÆ÷ÓйØϵµÄ¡£

2007-12-05 22:34
hyacinth
Rank: 1
µÈ¡¡¼¶£ºÐÂÊÖÉÏ·
Ìû¡¡×Ó£º3
ר¼Ò·Ö£º0
×¢¡¡²á£º2006-12-21
ÊÕ²Ø
µÃ·Ö:0 
»Ø¸´ 1# µÄÌû×Ó
ÎÒÔËÐÐʱҲûÓÐÎÊÌ⣬ºÇºÇ
2007-12-07 22:04
¿ìËٻظ´£ºÍ¼Æ¬ÎªÊ²Ã´²»ÏÔʾ£¿Ð»Ð»~~
Êý¾Ý¼ÓÔØÖÐ...
 
¡¡¡¡¡¡



¹ØÓÚÎÒÃÇ | ¹ã¸æºÏ×÷ | ±à³ÌÖйú | Çå³ýCookies | TOP | ÊÖ»ú°æ

±à³ÌÖйú °æȨËùÓУ¬²¢±£ÁôËùÓÐȨÀû¡£
Powered by Discuz, Processed in 0.030994 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved