编程论坛's Archiver

quanguoheme 发表于 2008-4-25 09:25

JLabel做的动画,很搞笑的

日啊  因为这网站对附件的限制 图片上传不了;如果想看的 把邮箱告诉我 我发文件给他;

[code]package m3434;
import  java.util.*;
import  java.awt.*;
import javax.swing.*;

/**
* @(#)Picture.java
*
*
* @author Heguojin
* @version 1.00 2008/4/10
*/


public class Newpicture5 extends JFrame
{
     
    public Newpicture5(String str)
             {
                     super (str);
         }
   
    public static void main (String[] args)
            {
                    try{
                   
                           
                   
                     int k=0;//属性
//NEW出Newpicture2及设置顶层容器
                    Newpicture5 pict= new Newpicture5("见过闷骚的没见过这么闷骚的");
                    pict.setSize(2222,2200);
            Container container =pict.getContentPane();
            container.setLayout(new FlowLayout());
            
//new出实现了Icon接口的全部的类并赋给VECTOR
            Vector vector = new Vector(100,1);
            for (int i=0;i<=101;i++ )
                     {
            vector.add(new ImageIcon("D:/591ni/Pic"+String.valueOf(i)+".jpg"   )   );
                     }
            
//new 出9个标签对象并且对其初始化
            JLabel lab1=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
             lab1.setToolTipText("这个SB叫郑新望 他的QQ是318258965:没女朋友,目前处于性饥渴中,请有意请多多联系");
            JLabel  lab2=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab3=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab4=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab5=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab6=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab7=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab8=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            JLabel  lab9=new JLabel((ImageIcon)vector.get(0) ,SwingConstants.LEFT);
            
           
//使图片按秩序播放
             while(true)// 使图片不停的播放
               {
             for(int i=0;i<=101;i++)
            {
            Thread.sleep(220);//设置每副图片的播放的时间间隔
            //取出向量中的对象并交给标签
            lab1.setIcon(  (ImageIcon)vector.get(i)    );
            if(i>54)//设置提示
            lab1.setToolTipText("这个家伙刘勇呢称小胖子 男.QQ:284518567"+"左右铭:世界上根本就没爱情有的只是生殖冲动摆了");
            lab2.setIcon(  (ImageIcon)vector.get(i)    );
            lab3.setIcon(  (ImageIcon)vector.get(i)    );
            lab4.setIcon(  (ImageIcon)vector.get(i)    );
                   lab5.setIcon(  (ImageIcon)vector.get(i)    );
                   lab6.setIcon(  (ImageIcon)vector.get(i)    );
                   lab7.setIcon(  (ImageIcon)vector.get(i)    );
                   lab8.setIcon(  (ImageIcon)vector.get(i)    );
                   lab9.setIcon(  (ImageIcon)vector.get(i)    );
                    
                   //把标签添加到内容面板                                  
            container.add(lab1);
            container.add(lab2);
            container.add(lab3);
            container.add(lab4);
            container.add(lab5);
            container.add(lab6);
            container.add(lab7);
            container.add(lab8);
            container.add(lab9);
            
            pict.setVisible(true);
            pict.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             if(i==0)//使开始动画放长点时间
                    Thread.sleep(5554);
            if(i==101)//使结束动画放长点时间
                     Thread.sleep(4444);
            }
               }
        
           }
           
           
//抓获异常
           catch(ExceptionInInitializerError e)
            {
                   System.out.print(e);
                   }
                   catch(OutOfMemoryError c)
                   {
                   System.out.print(c);
                   }       
                          
           catch(Exception d)
           {
                   System.out.print(d);
           }
                  
           
        }
   
   
}[/code]

lxm520910 发表于 2008-4-25 14:15

lxm520910@163.com   谢谢了~!~

psoul1234 发表于 2008-4-27 00:31

xueyin752184@yahoo.com.cn    谢谢

wu1011 发表于 2008-4-27 09:51

wuhang_520544@sina.com

killer_l 发表于 2008-4-27 12:07

killerkiller1@163.com
看看是啥[tk05]

xuhang13 发表于 2008-4-27 13:41

gei wo yige  xuhang13@163.com

quanguoheme 发表于 2008-5-1 13:40

我是楼住

不好拖了这么才发

kgdyffje 发表于 2008-5-1 19:24

kgdyffjeqq@163.com
  谢了

jinenghui 发表于 2008-5-4 12:27

邮箱jinenghui@sina.com
谢谢!

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.