Java Applet 入门

  • v4_472324
    了解作者
  • 451.4KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-21 04:15
    上传日期
Java Applet 入门
Java Applet 入门.rar
  • javaapplet
  • 03
  • 12.htm
    6.8KB
  • 13.htm
    8.6KB
  • 1.htm
    8.4KB
  • Applet2.class
    722B
  • 11.htm
    6.7KB
  • Applet1.class
    520B
  • Liebiao1.class
    977B
  • 14.htm
    6.6KB
  • 16.htm
    7.6KB
  • DanXuan.class
    1.1KB
  • 15.htm
    7.5KB
  • TimeShow.class
    1.9KB
  • FuXuan.class
    987B
  • Applet3.class
    794B
  • 02
  • 12.htm
    10.5KB
  • 13.htm
    20.9KB
  • 1.htm
    6.1KB
  • Jinzita.class
    646B
  • 11.htm
    9.4KB
  • Applet1.class
    1.1KB
  • 14.htm
    8.2KB
  • 15.htm
    10.3KB
  • Leixing.class
    1.1KB
  • TimeShow.class
    1.9KB
  • ShuZu.class
    1.3KB
  • 04
  • 12.htm
    6.2KB
  • 13.htm
    6.9KB
  • 1.htm
    12KB
  • 11.htm
    6.6KB
  • Mouse.class
    1KB
  • KeyStrike.class
    1.4KB
  • TimeShow.class
    1.9KB
  • Aa1.class
    610B
  • yuanma
  • fangda
  • 058.gif
    20.5KB
  • fangda.htm
    418B
  • magnifier.class
    4.4KB
  • juan
  • juan.htm
    794B
  • VColorScroll.class
    4.7KB
  • line
  • MagicLine2.class
    3.6KB
  • MagicLine1.class
    3.7KB
  • line.html
    697B
  • tan
  • tan.htm
    704B
  • TextBouncer.class
    9.2KB
  • diqiu
  • diqiu.htm
    259B
  • clock7am.class
    4.9KB
  • clock64.gif
    3.7KB
  • snoopy
  • Clock2.class
    5.2KB
  • Clock.class
    3KB
  • snoopy.htm
    300B
  • laxmi
  • Morph.java
    8.3KB
  • spoon.jpg
    5KB
  • male.jpg
    7.4KB
  • Morph.class
    7.8KB
  • author.JPG
    10.9KB
  • Morph.htm
    605B
  • touying
  • 026.gif
    22.7KB
  • touying.htm
    494B
  • ripple.class
    3.9KB
  • ch
  • ch.htm
    747B
  • Bullets.class
    11.6KB
  • colors
  • colors.class
    6.1KB
  • color.htm
    237B
  • xj
  • explosion.au
    10.7KB
  • index.html
    3.2KB
  • starwar.html
    159B
  • shipexplode.gif
    2KB
  • star.gif
    864B
  • shipexplode.au
    22KB
  • laser.au
    2.7KB
  • xj.htm
    281B
  • FallingStars.class
    17KB
  • ship.gif
    220B
  • alert.au
    15KB
  • diqiu.zip
    7KB
  • tan.zip
    5.4KB
  • xj.zip
    44.8KB
  • snoopy.zip
    5.2KB
  • fangda.zip
    23.3KB
  • juan.zip
    3.3KB
  • ch.zip
    7.2KB
  • touying.zip
    25.6KB
  • colors.zip
    3.4KB
  • laxmi.zip
    26.9KB
  • line.zip
    4.5KB
内容介绍
//Applet : Morph - Sep 11 '99. //Author : Laxmi Narayana .Kota // E-mail id: laxmikota@hotmail.com import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.applet.*; public class Morph extends Applet implements Runnable{ boolean isStandalone = false; int w,h,cnt=0,cnt1=0,totalpictures,temp,max,delay; int buf[],clearbuf[],bufimg[][],imagewidth,imageheight; static int zoomout=1; int lsmargin[],rsmargin[],ldmargin[],rdmargin[],lscnt=0,rscnt=0,clear[],ldcnt=0,rdcnt=0; int srcdif,dstdif,tempdif,xdif,xinc; int tcnt=0, bcnt=0,tsmargin=0,bsmargin=0,tdmargin=0,bdmargin=0; int dsthdif,srchdif,preh,yinc; // l - left ; r- right; ls - left source; rs - right source // t- top of the image; b - bottom of the image // ld - left margin of destination image // rd - right margin 0f destination image Thread t; Image img[],img1; MediaTracker med; PixelGrabber pg[]; String imagenames[],bgcolor,fontcolor,author; Graphics offscreengraphics; Image offscreenimage=null; public String getParameter(String key, String def) { return isStandalone ? System.getProperty(key, def) : (getParameter(key) != null ? getParameter(key) : def); } public Morph() { } public void init() { //t=new Thread(this); try{ totalpictures=Integer.parseInt(getParameter("totalpictures","0")); bgcolor=this.getParameter("bgcolor","0x000000"); fontcolor=this.getParameter("fontcolor","0x00ff00"); max=Integer.parseInt(getParameter("fadecount","30")); delay=Integer.parseInt(getParameter("delay","30")); author=getParameter("author",""); }catch(Exception exce){} if(!author.equalsIgnoreCase("Laxminarayana.kota")) System.exit(0); this.setBackground(new Color(Integer.parseInt(bgcolor.substring(2),16))); img=new Image[totalpictures]; imagenames=new String[totalpictures]; if(totalpictures >0 ) { try{ for(int i=0;i<totalpictures;i++) imagenames[i]=getParameter("imagenames["+i+"]",""); }catch(Exception exce){} } for(int i=0;i<totalpictures;i++) img[i]=getImage(getCodeBase(),imagenames[i]); med=new MediaTracker(this); for(int i=0;i<img.length;i++) med.addImage(img[i],0); //t.start(); } public void start() { t= new Thread(this); t.start(); } public void run() { try{ med.waitForAll(); imagewidth=img[0].getWidth(null);imageheight=img[0].getHeight(null); buf=new int[imagewidth*imageheight];clearbuf=new int[imagewidth*imageheight]; lsmargin=new int[imageheight];rsmargin=new int[imageheight]; ldmargin=new int[imageheight];rdmargin=new int[imageheight]; clear=new int[imageheight]; for(int i=0;i<imageheight;i++) for(int j=0;j<imagewidth;j++) {buf[imagewidth*i+j]=0xffffff; clearbuf[imagewidth*i+j]=0xffffff;} for(int i=0; i<imageheight; ++i) clear[i]=0; bufimg=new int[img.length][imagewidth*imageheight]; clear=new int[imageheight];pg=new PixelGrabber[img.length]; for(int i=0;i<img.length;i++) {pg[i]=new PixelGrabber(img[i],0,0,imagewidth,imageheight,bufimg[i],0,imagewidth); pg[i].grabPixels(); } }catch (InterruptedException exce){getAppletContext().showStatus("Loading images is failed");} try{ for(;;){ cnt++; if(cnt>max) { cnt1++; if(cnt1>img.length-1)cnt1=0; cnt=0; } temp=(cnt1 <(img.length-1)) ? 1+cnt1 : 0; System.arraycopy(clearbuf,0,buf,0,imagewidth*imageheight); tcnt=0; /* System.arraycopy(clear,0,lsmargin,0,imageheight); System.arraycopy(clear,0,rsmargin,0,imageheight); System.arraycopy(clear,0,ldmargin,0,imageheight); System.arraycopy(clear,0,rdmargin,0,imageheight);*/ if(cnt>=0 && cnt<=1){ for(int i=0; i<imageheight; ++i) // left margin of source image {lscnt=0;rscnt=0; for(int j=0; j<zoomout*imagewidth; ++j) { if(lscnt==0 && j>0){ if( filter(bufimg[cnt1][imagewidth*i+j*imagewidth/(zoomout*imagewidth)],11) != filter(bufimg[cnt1][imagewidth*i],11) ){ lsmargin[i]=j/zoomout;lscnt++; if(tcnt==0){tsmargin=i;tcnt++;}else tcnt++;} } } } bsmargin=tcnt + tsmargin;tcnt=0; // takes up the bottom margin of the image for(int i=0; i<imageheight; ++i) // for right margin of soure image {rscnt=0; for(int j=0; j<zoomout*imagewidth; ++j) { if (rscnt==0 && j<zoomout*imagewidth){ if( filter(bufimg[cnt1][imagewidth*i+(zoomout*imagewidth-1-j)*imagewidth/(zoomout*imagewidth)],11) != filter(bufimg[cnt1][imagewidth*i+imagewidth-1],11) ){ rsmargin[i]=j/zoomout;rscnt++;} } } } for(int i=0; i<imageheight; ++i)// left margin of destination image {ldcnt=0;rdcnt=0; for(int j=0; j<zoomout*imagewidth; ++j) { if(ldcnt==0 && j>0){ if( filter(bufimg[temp][imagewidth*i+j*imagewidth/(zoomout*imagewidth)],11) != filter(bufimg[temp][imagewidth*i],11) ){ ldmargin[i]=j/zoomout;ldcnt++; if(tcnt==0){tdmargin=i;tcnt++;}else tcnt++; } } } } bdmargin=tcnt+tdmargin;tcnt=0; // bottom margin of the destination image for(int i=0; i<imageheight; ++i) //right margin of destination image { rdcnt=0; for(int j=0; j<zoomout*imagewidth; ++j) { if (rdcnt==0 && j<zoomout*imagewidth){ if( filter(bufimg[temp][imagewidth*i+(zoomout*imagewidth-1-j)*imagewidth/(zoomout*imagewidth)],11) != filter(bufimg[temp][imagewidth*i+imagewidth-1],11) ){ rdmargin[i]=j/zoomout;rdcnt++;} } } } } for(int k=0;k<imageheight;++k) { dsthdif=bdmargin-tdmargin; //132 srchdif=bsmargin-tsmargin; // 76 yinc=tsmargin - (tsmargin - tdmargin)*cnt/max;//27-25*30/30=2 preh=srchdif - (srchdif - dsthdif)*cnt/max;//76- (-56)*30/30=134 if(k>=yinc && k<=yinc+preh) {for(int j=0;j<imagewidth;++j) {int scalehsrc,scalehdst; scalehsrc=tsmargin+(k-yinc)*srchdif/preh;//27+(132)*76/132 scalehdst=tdmargin+(k-yinc)*dsthdif/preh;//2+76*132/76 dstdif=(imagewidth-1-rdmargin[scalehdst]) - ldmargin[scalehdst]; srcdif=(imagewidth-1-rsmargin[scalehsrc]) - lsmargin[scalehsrc]; xdif=lsmargin[scalehsrc] - ldmargin[scalehdst]; xinc=lsmargin[scalehsrc] - xdif*(cnt)/max; //(max-cnt)/max; tempdif=srcdif - (srcdif-dstdif)*(cnt)/max; if(j>xinc && j<=xinc+tempdif) {int x1,x; x=imagewidth*scalehsrc+lsmargin[scalehsrc]+(j-xinc)*srcdif/tempdif;// for src image x1=imagewidth*scalehdst+ldmargin[scalehdst]+(j-xinc)*dstdif/tempdif;// for dst image buf[imagewidth*k+j]=0xff<<24 |( compositefilter(bufimg[cnt1][x],max-cnt)+compositefilter(bufimg[temp][x1],cnt)); }else buf[imagewidth*k+j]=0xff000000; } } } img1=createImage(new MemoryImageSource(imagewidth,imageheight,buf,0,imagewidth)); if(cnt==max) t.sleep(1000); else t.sleep(delay); repaint(); } }catch(InterruptedException e){} } public synchronized void update(Graphics g) { Dimension d = getSize(); if((offscreenimage == null)) { offscreenimage = createImage(d.width, d.height); offscreengraphics= offscreenimage.getGraphics(); } offscreengraphics.setColor(getBackground()); offscreengraphics.fillRect(0, 0, d.width, d.height); paint(offscreengraphics); g.drawImage(offscreenimage, 0, 0,this); } public void paint(Graphics g) { if(med.statusAll(false)==med.COMPLETE) g.drawImage(img1,0,0,this); else { g.setColor(new Color(Integer.parseInt(fontcolor.substring(2),16))); g.drawString("Loading Images Please wait...",20,100); } } public void stop() { t.interrupt(); } public void destroy() { if(t != null){t=null;} } public String getAppletInfo() { return "Morph by LaxmiNara
评论
    相关推荐
    • Java
      Java 对于Java练习
    • java
      Java Java基础
    • Java
      Java 我创建的Java项目
    • JAVA教程
      一本非常不错的清华大学java教程,讲解非常详细,看了就知道。
    • Java Cipher
      Java Cipher 加密和解密工具 附带源码 Java Cipher 加密和解密工具 附带源码 Java Cipher 加密和解密工具 附带源码 Java Cipher 加密和解密工具 附带源码
    • javabank
      Java银行 Java com的模拟操作将在bancárias上发布! 要求:Java 8。
    • java 李兴华
      java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java 李兴华 java ...
    • JAVA教程
      详细介绍了JAVA语言程序设计,对JAVA的基础知识运用实例的方式来讲解,使初学者能够非常轻松的掌握。
    • java程序
      java程序-吃点点java程序-吃点点java程序-吃点点java程序-吃点点java程序-吃点点java程序-吃点点
    • Java
      Java 2021/02/19 .java Main.java 学生.java Bmi.java 。班级 Bmi类 主类 MyBmi.class 学生班 学生样本类 2021/02/20 .java DeleteFile.java WriteFile.java MyDataPrint.java 。班级 DeleteFile.class ...