| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1383 人关注过本帖
标题:载入java小应用程序失败??
只看楼主 加入收藏
hjp200
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2005-12-21
收藏
 问题点数:0 回复次数:3 
载入java小应用程序失败??

下面的程序中,载入java小应用程序失败,请教大家错在哪里(所加载的java类可以编译和运行,如下的黑体字)?谢谢!!




<%@ page language="java" import="java.awt.*,java.applet.*,java.awt.event.*" %>
<%@ page contentType="text/html;charset=GB2312" %>
<html>
<head>
<title>
烟花
</title>
</head>
<body>
<jsp:plugin type="applet" code="FireTree.class" jreversion="1.4"
width="500" height="200">
<jsp:fallback>
Plugin tag OBJECT or EMBED not supported by browser.
</jsp:fallback>
</jsp:plugin>
<%!
public class FireTree extends Applet implements Runnable
{
final int Max = 1000;
ftparticle p[];
int AppletWidth,AppletHeight,XCenter,YCenter;
Image OffScreen;
Graphics drawOffScreen;
Thread pThread;

public void init()
{
setBackground(Color.black);

p = new ftparticle[Max];

AppletWidth = getSize().width;
AppletHeight = getSize().height;

XCenter = AppletWidth/2;
YCenter = 2*AppletHeight/3;

for(int i=0; i<Max; i++)
p[i] = new ftparticle(XCenter,YCenter);

OffScreen = createImage(AppletWidth,AppletHeight);
drawOffScreen = OffScreen.getGraphics();
}

public void start()
{
pThread = new Thread(this);
pThread.start();
}

public void stop()
{
pThread = null;
}

public void update(Graphics g)
{
paint(g);
}

public void paint(Graphics g)
{
g.drawImage(OffScreen,0,0,this);
}

public void run()
{
int i;
while(true)
{
drawOffScreen.clearRect(0,0,AppletWidth,AppletHeight);
drawOffScreen.setColor(Color.white);
drawOffScreen.fillRect(XCenter,YCenter,5,AppletHeight/3);

for(i=0; i<Max; i++)
{
if(p[i].Y > AppletHeight)
p[i].reset(XCenter,YCenter);

drawOffScreen.setColor(p[i].color);
drawOffScreen.fillOval((int)p[i].X,(int)p[i].Y,3,3);
p[i].X += p[i].Vx;
p[i].Y += p[i].Vy;
p[i].Vy += 9.8*p[i].time/5;
p[i].time++;
}

repaint();

try {
Thread.sleep(200);
}
catch (InterruptedException e) { }
}
}
}

class ftparticle
{
boolean state;
double X,Y;
double Vx,Vy;
int time;
Color color;

public ftparticle(int x,int y)
{
X = x;
Y = y;
reset(x,y);
}

public void reset(int x, int y)
{

X = x;
Y = y;
Vx = (int)(Math.random()*10 - Math.random()*10);
Vy = (int)(-Math.random()*20 - 1);
time = 0;
color = new Color((int)(Math.random()*255),
(int) (Math.random()*255),
(int) (Math.random()*255));
}
}
%>
</body>
</html>

搜索更多相关主题的帖子: java 应用程序 载入 失败 
2005-12-30 09:31
hjp200
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2005-12-21
收藏
得分:0 
大家帮个忙嘛!
2005-12-31 09:00
tody
Rank: 1
等 级:新手上路
威 望:2
帖 子:119
专家分:0
注 册:2005-11-17
收藏
得分:0 

code="FireTree.class"
你把Applet写在JSP里面,哪来的的class文件?!


记录就是用来破的, 自尊就是用来伤的。
2005-12-31 09:53
czyboy123
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2006-2-16
收藏
得分:0 

小程序另外编译啊,这样写出来也行。。。

2006-02-21 19:56
快速回复:载入java小应用程序失败??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.040932 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved