AnimNav.zip

  • 管理员
    了解作者
  • Java
    开发工具
  • 231KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 850
    下载次数
  • 2001-01-18 16:26
    上传日期
很酷的用鼠标拖着转动的图形地址条
AnimNav.zip
  • images
  • nav13.jpg
    7.1KB
  • nav26.jpg
    7.1KB
  • nav28.jpg
    7.3KB
  • nav11.jpg
    7.1KB
  • nav21.jpg
    6.5KB
  • nav23.jpg
    6.8KB
  • nav27.jpg
    7.3KB
  • nav14.jpg
    7.2KB
  • nav10.jpg
    7.1KB
  • nav19.jpg
    7KB
  • nav3.jpg
    6.9KB
  • nav4.jpg
    6.9KB
  • nav18.jpg
    7.3KB
  • nav9.jpg
    7.1KB
  • nav16.jpg
    7.3KB
  • nav22.jpg
    6.8KB
  • nav30.jpg
    7.4KB
  • nav5.jpg
    6.7KB
  • nav6.jpg
    6.7KB
  • nav8.jpg
    7KB
  • nav12.jpg
    7.1KB
  • nav15.jpg
    7.2KB
  • nav1.jpg
    7.1KB
  • nav20.jpg
    6.8KB
  • nav0.jpg
    7.4KB
  • nav24.jpg
    6.9KB
  • nav2.jpg
    6.9KB
  • nav29.jpg
    7.2KB
  • nav17.jpg
    7.3KB
  • nav7.jpg
    6.9KB
  • nav25.jpg
    7KB
  • www.pudn.com.txt
    218B
  • AnimNav.htm
    31.9KB
  • .htaccess
    120B
  • AnimNav.class
    6.9KB
  • AnimNav.java
    14.2KB
  • NavAutoRun.class
    1.2KB
内容介绍
/* AnimNav.java Version 1.0.0 Written by Elijah Dean Meeker 1/4/96 Clicking it navagates to the given URL. It uses off-screen buffering to avoid flicker. Here is a valid applet tags: [Optional params are in brackets][Second brackets contain defaults] <aPPLET codebase="classes" CODE="AnimNav.class" WIDTH=75 HEIGHT=75 rel='nofollow' onclick='return false;'> SIZE of button images [<PARAM NAME="spriteX" VALUE="10">] LEFT pos. to draw sub-images[0] [<PARAM NAME="spriteY" VALUE="10">] TOP pos. to draw sub-images [0] [<PARAM NAME="sleeptime" VALUE="500">] TIME between images[autorun off] <PARAM NAME="imageCount" VALUE="8"> Image Count <PARAM NAME="translation" VALUE="0|0|1|1|2|2|3|3"> Which URL goes with which frame of animation <PARAM NAME="URLcount" VALUE="4"> URL count <PARAM NAME="dest0" VALUE="http://www.realtime.net/~elijah/"> URL to navigate to <PARAM NAME="dest1" VALUE="http://www.mel.dit.csiro.au/~brendan/">URL to navigate to <PARAM NAME="dest2" VALUE="http://198.3.117.222"> URL to navigate to <PARAM NAME="dest3" VALUE="http://www.sun.com/"> URL to navigate to [<PARAM NAME="desc0" VALUE="Homepage of Elijah Dean Meeker">] URL description [<PARAM NAME="desc1" VALUE="Homepage of Brendan Hills">] URL description [<PARAM NAME="desc2" VALUE="BreakFast Cereal Hall Of Fame">] URL description [<PARAM NAME="desc3" VALUE="Sun Microsystems">] URL description [<PARAM NAME="target0" VALUE="_jmainview">] target window for URL[_parent] [<PARAM NAME="background" VALUE="images/cub_bg.jpg"> ]BACKGROUND image(offset from codebase) <PARAM NAME="prefix" VALUE="images/nav"> Prefix of images(offset from codebase) [<PARAM NAME="imagetype" VALUE="jpg">] Image type-WITHOUT '.'[jpg] </APPLET> Please feel free to improve this code. It would not be here but for the freely given help of others. I would love to see your improvements. Elijah. elijah@bga.com http://www.realtime.net/~elijah/ */ import java.applet.Applet; import java.applet.AudioClip; import java.awt.Dimension; import java.awt.Event; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.lang.InterruptedException; import java.net.MalformedURLException; import java.net.URL; /******************************************************************************/ /**************************AnimNav.class***************************************/ public class AnimNav extends java.applet.Applet { //Graphics MediaTracker tracker; Dimension d; //for sizing offscreen buffer Graphics offscreen; Image buf; Image bg; //background image Image img[];//array of sprite images //AutoRun class NavAutoRun autoRun; int spriteX,spriteY;//sprite offset on background int imageCount; //total number of sprite images int oldx = 0; //tested in mouseDrag int downx=0; //tested in mouseUp public int frame = 0; //current frame of animation public int URLcount=0; boolean bgP=true; //background image loaded flag boolean autorunP=false; //autorun setup flag URL URLdest[]; //list of URLs String URLdescription[]; //URLdescriptions String targetWindow[]; int translate[]; //Which URLs go with which frames of the animation /****************************STATE CHANGES*************************************/ public void init(){ String str; String imageType; //offscreen buffer //System.out.println("offscreen buffer"); d = size(); buf= createImage(d.width,d.height); offscreen = buf.getGraphics(); //MediaTracker //System.out.println("MediaTracker"); tracker = new MediaTracker(this); /************************LOAD spriteX****************************/ str =getParameter("spritex"); if(str== null){ spriteX=0; }else{ spriteX=Integer.parseInt(str); } /************************LOAD spriteY****************************/ str =getParameter("spritey"); if(str== null){ spriteY=0; }else{ spriteY=Integer.parseInt(str); } /*********************LOAD NavAutoRun init************************/ str =getParameter("sleeptime"); if(str!= null){ autorunP=true; autoRun=new NavAutoRun(this,Integer.parseInt(str)); } /************************LOAD urlcount**************************/ //System.out.println("URLdest"); str= getParameter("urlcount"); if (str == null){ System.out.println ("Error Loading: urlcount, Not Optional"); }else{ URLcount= Integer.parseInt(str); URLdescription=new String[URLcount]; targetWindow=new String[URLcount]; URLdest=new URL[URLcount]; }//ned if /************************LOAD URLs**************************/ //System.out.println("URLs"); for(int c=0;c<URLcount;c++){ URLdescription[c]= getParameter("dest"+c); try{ if (URLdescription[c] != null) //this is here for development URLdest[c] = new URL(URLdescription[c]); }catch(MalformedURLException mal){ System.out.println("Malformed URL: Check Applet Tag."); } }//end for /************************LOAD URL Descriptions*********************/ for(int c=0;c<URLcount;c++){ str= getParameter("desc"+c); if (str != null){ URLdescription[c]=str; } }//end for /************************LOAD URL targetWindow*********************/ for(int c=0;c<URLcount;c++){ str= getParameter("target"+c); if (str == null){ targetWindow[c]=" _parent"; }else{ targetWindow[c]=str; } }//end for /************************LOAD imageCount**************************/ //System.out.println("imageCount"); str =getParameter("imagecount"); if (str == null){ System.out.println ("Error getting Parameter: imagecount, Not Optional."); }else{ imageCount= Integer.parseInt(str); img = new Image[imageCount]; } /************************LOAD translate[]*************************/ str = getParameter("translation"); if (str == null){ System.out.println ("Error getting Parameter: translation, Not Optional."); }else{ translate=new int[imageCount]; int index=0; for (int i = 0; i < str.length(); ) { if (index >= imageCount) break; int next=str.indexOf('|', i); if (next == -1) next = str.length(); if (i != next) { translate[index]=Integer.parseInt(str.substring(i, next)); index++; }//end if i = next + 1; }//end for }//end if str==null /* //this would also work for above StringTokenizer st = new StringTokenizer(s,"|"); while (st.hasMoreTokens()) { translate[index]=Integer.parseInt(st.nextToken()); index++; } */ /************************LOAD imagetype**************************/ //System.out.println("imagetype"); str = getParameter("imagetype"); if (str == null){ imageType="jpg"; }else{ imageType=str; }//end if /************************LOAD background image**************************/ //System.out.println("background"); str = getParameter("background"); if (str == null){ bgP=false; //not using background image spriteX=0;spriteY=0; }else{ showStatus("Loading Background Image"); bg = getImage(getCodeBase(),str); tracker.addImage(bg, 0); try { tracker.waitForAll(); } catch (InterruptedException e) { System.out.println("Error waiting for Background image to load."); }//end catch showStatus(""); }//end if /************************LOAD animation images*********************/ //System.out.println("Sprites"); str = getParameter("prefix"
评论
    相关推荐