/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* -Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* -Redistribution in binary form must reproduct the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT
* BE LIABLE FOR ANY DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT
* OF OR RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THE SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN
* IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that Software is not designed, licensed or intended for
* use in the design, construction, operation or maintenance of any nuclear
* facility.
*/
/*
* @(#)Animator.java 1.9 03/01/23
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.applet.AudioClip;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
/**
* An applet that plays a sequence of images, as a loop or a one-shot.
* Can have a soundtrack and/or sound effects tied to individual frames.
* See the <a href="http://java.sun.com/applets/applets/Animator/">Animator
* home page</a> for details and updates.
*
* @author Herb Jellinek
* @version 1.9, 01/23/03
*/
public class Animator extends Applet implements Runnable, MouseListener {
int appWidth = 0; // Animator width
int appHeight = 0; // Animator height
Thread engine = null; // Thread animating the images
boolean userPause = false; // True if thread currently paused by user
boolean loaded = false; // Can we paint yet?
boolean error = false; // Was there an initialization error?
Animation animation = null; // Animation this animator contains
String hrefTarget = null; // Frame target of reference URL if any
URL hrefURL = null; // URL link for information if any
static final String sourceLocation =
"http://java.sun.com/applets/applets/Animator/";
static final String userInstructions = "shift-click for errors, info";
static final int STARTUP_ID = 0;
static final int BACKGROUND_ID = 1;
static final int ANIMATION_ID = 2;
/**
* Applet info.
*/
public String getAppletInfo() {
return "Animator v1.10 (02/05/97), by Herb Jellinek";
}
/**
* Parameter info.
*/
public String[][] getParameterInfo() {
String[][] info = {
{"imagesource", "URL", "a directory"},
{"startup", "URL", "image displayed at start-up"},
{"backgroundcolor", "int", "background color (24-bit RGB number)"},
{"background", "URL", "image displayed as background"},
{"startimage", "int", "index of first image"},
{"endimage", "int", "index of last image"},
{"namepattern", "URL", "generates indexed names"},
{"images", "URLs", "list of image indices"},
{"href", "URL", "page to visit on mouse-click"},
{"target", "name", "frame to put that page in"},
{"pause", "int", "global pause, milliseconds"},
{"pauses", "ints", "individual pauses, milliseconds"},
{"repeat", "boolean", "repeat? true or false"},
{"positions", "coordinates", "path images will follow"},
{"soundsource", "URL", "audio directory"},
{"soundtrack", "URL", "background music"},
{"sounds", "URLs", "list of audio samples"},
};
return info;
}
/**
* Show a crude "About" box. Displays credits, errors (if any), and
* parameter values and documentation.
*/
void showDescription() {
DescriptionFrame description = new DescriptionFrame();
description.tell("\t\t"+getAppletInfo()+"\n");
description.tell("Updates, documentation at "+sourceLocation+"\n\n");
description.tell("Document base: "+getDocumentBase()+"\n");
description.tell("Code base: "+getCodeBase()+"\n\n");
Object errors[] = animation.tracker.getErrorsAny();
if (errors != null) {
description.tell("Applet image errors:\n");
for (int i = 0; i < errors.length; i++) {
if (errors[i] instanceof Image) {
AnimationFrame frame = (AnimationFrame)
animation.frames.get(i);
URL url = frame.imageLocation;
if (url != null) {
description.tell(" "+url+" not loaded\n");
}
}
}
description.tell("\n");
}
if (animation.frames == null || animation.frames.size() == 0)
description.tell("\n** No images loaded **\n\n");
description.tell("Applet parameters:\n");
description.tell(" width = "+getParameter("WIDTH")+"\n");
description.tell(" height = "+getParameter("HEIGHT")+"\n");
String params[][] = getParameterInfo();
for (int i = 0; i < params.length; i++) {
String name = params[i][0];
description.tell(" "+name+" = "+getParameter(name)+
"\t ["+params[i][2]+"]\n");
}
description.show();
}
/**
* Local version of getParameter for debugging purposes.
*/
public String getParam(String key) {
String result = getParameter(key);
return result;
}
/**
* Get parameters and parse them
*/
public void handleParams() {
try {
String param = getParam("IMAGESOURCE");
animation.imageSource = (param == null) ? getDocumentBase() :
new URL(getDocumentBase(), param + "/");
String href = getParam("HREF");
if (href != null) {
try {
hrefURL = new URL(getDocumentBase(), href);
} catch (MalformedURLException e) {
showParseError(e);
}
}
hrefTarget = getParam("TARGET");
if (hrefTarget == null)
hrefTarget = "_top";
param = getParam("PAUSE");
if (param != null)
animation.setGlobalPause(Integer.parseInt(param));
param = getParam("REPEAT");
animation.repeat = (param == null) ? true :
(param.equalsIgnoreCase("yes") ||
param.equalsIgnoreCase("true"));
int startImage = 1;
int endImage = 1;
param = getParam("ENDIMAGE");
if (param != null) {
endImage = Integer.parseInt(param);
param = getParam("STARTIMAGE");
if (param != null) {
startImage = Integer.parseInt(param);
}
param = getParam("NAMEPATTERN");
animation.prepareImageRange(startImage, endImage, param);
} else {
param = getParam("STARTIMAGE");
if (param != null) {
startImage = Integer.parseInt(param);
param = getParam("NAMEPATTERN");
animation.prepareImageRange(startImage, endImage, param);
} else {
param = getParam("IMAGES");
if (p
没有合适的资源?快使用搜索试试~ 我知道了~
java 关于动画的一段处理程序,很精采的-java animation on the procedures for hand
共35个文件
gif:13个
au:11个
class:5个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 36 浏览量
2023-01-09
19:57:24
上传
评论
收藏 184KB RAR 举报
温馨提示
java 关于动画的一段处理程序,很精采的]-java animation on the procedures for handling a very interesting]
资源推荐
资源详情
资源评论
收起资源包目录
java 关于动画的一段处理程序,很精采的]-java animation on the procedures for handling a very interesting].rar (35个子文件)
www.pudn.com.txt 218B
Animator
example4.html 2KB
AnimationFrame.class 538B
Animator.class 10KB
DescriptionFrame.class 1KB
ParseException.class 222B
example2.html 2KB
audio
7.au 980B
8.au 1KB
3.au 993B
5.au 1016B
4.au 1006B
0.au 1010B
spacemusic.au 47KB
1.au 946B
2.au 1KB
6.au 1KB
9.au 989B
example1.html 2KB
Animator.java 28KB
Animation.class 7KB
example3.html 3KB
images
Beans
T8.gif 12KB
T5.gif 10KB
T6.gif 8KB
T2.gif 11KB
T4.gif 12KB
T3.gif 11KB
T10.gif 13KB
T9.gif 10KB
T1.gif 11KB
T7.gif 8KB
loading-msg.gif 1KB
SimpleAnimation
T2.gif 4KB
T1.gif 4KB
共 35 条
- 1
资源评论
GZM888888
- 粉丝: 120
- 资源: 2902
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功