当前位置: 技术问答>java相关
100分求Applet的实例(先放50)
来源: 互联网 发布时间:2015-04-06
本文导语: 哪位有做好的Applet的例子,能给我一份吗?谢谢。 | mport java.applet.Applet; import java.awt.*; public class fire extends Applet implements Runnable { boolean first = false; int ROWS = 0; ...
哪位有做好的Applet的例子,能给我一份吗?谢谢。
|
mport java.applet.Applet;
import java.awt.*;
public class fire extends Applet
implements Runnable
{
boolean first = false;
int ROWS = 0;
int COLS = 0;
int HIDDEN = 0;
int ROWS_SEED = 0;
int ROWS_RESEED = 0;
int MAX_SEED = 0;
int PALETTE_SIZE = 0;
int COOLING_LIMIT = 0;
int COOLING_ROWS = 0;
int COOLING_FACTOR = 0;
Color palette[] = null;
byte Buffer[] = null;
byte Buffer2[] = null;
String message = null;
String textfont = null;
int textsize = 0;
int textX = 0;
int textY = 0;
Color textcolor = null;
Image offScrImage = null;
Graphics offScrGC = null;
Dimension offScrSize = null;
Thread kicker = null;
public String getAppletInfo()
{
return "Fire applet by Javier Rodriguez ";
}
public String[][] getParameterInfo()
{
String as[][] = {
{
"coolingrows", "int", "number of rows to cool"
}, {
"coolingfactor", "int", "cooling factor"
}, {
"coolinglimit", "int", "cooling threshold"
}, {
"soundtrack", "url", "background sound"
}, {
"text", "String", "message"
}, {
"textcolor", "String", "text color"
}, {
"textfont", "String", "text font"
}, {
"textsize", "int", "text size"
}
};
return as;
}
public void init()
{
COLS = size().width;
ROWS = size().height + HIDDEN;
String s = getParameter("coolinglimit");
if(s != null && s.endsWith("%"))
s = s.substring(0, s.length() - 1);
COOLING_LIMIT = s != null ? (PALETTE_SIZE * Integer.valueOf(s).intValue()) / 100 : (int)((double)PALETTE_SIZE * 0.5D);
s = getParameter("coolingrows");
if(s != null && s.endsWith("%"))
s = s.substring(0, s.length() - 1);
COOLING_ROWS = s != null ? (ROWS * Integer.valueOf(s).intValue()) / 100 : (int)((double)ROWS * 0.80000000000000004D);
s = getParameter("coolingfactor");
COOLING_FACTOR = s != null ? Integer.valueOf(s).intValue() : 2;
ROWS_RESEED = (int)((double)ROWS * 0.95999999999999996D);
s = getParameter("text");
message = s != null ? s : "";
s = getParameter("textfont");
textfont = s != null ? s : "TimesRoman";
s = getParameter("textsize");
textsize = s != null ? Integer.valueOf(s).intValue() : 18;
s = getParameter("textcolor");
textcolor = hexColor(s, Color.white);
Buffer = new byte[COLS * ROWS];
Buffer2 = new byte[COLS * ROWS];
for(int j = 0; j
import java.awt.*;
public class fire extends Applet
implements Runnable
{
boolean first = false;
int ROWS = 0;
int COLS = 0;
int HIDDEN = 0;
int ROWS_SEED = 0;
int ROWS_RESEED = 0;
int MAX_SEED = 0;
int PALETTE_SIZE = 0;
int COOLING_LIMIT = 0;
int COOLING_ROWS = 0;
int COOLING_FACTOR = 0;
Color palette[] = null;
byte Buffer[] = null;
byte Buffer2[] = null;
String message = null;
String textfont = null;
int textsize = 0;
int textX = 0;
int textY = 0;
Color textcolor = null;
Image offScrImage = null;
Graphics offScrGC = null;
Dimension offScrSize = null;
Thread kicker = null;
public String getAppletInfo()
{
return "Fire applet by Javier Rodriguez ";
}
public String[][] getParameterInfo()
{
String as[][] = {
{
"coolingrows", "int", "number of rows to cool"
}, {
"coolingfactor", "int", "cooling factor"
}, {
"coolinglimit", "int", "cooling threshold"
}, {
"soundtrack", "url", "background sound"
}, {
"text", "String", "message"
}, {
"textcolor", "String", "text color"
}, {
"textfont", "String", "text font"
}, {
"textsize", "int", "text size"
}
};
return as;
}
public void init()
{
COLS = size().width;
ROWS = size().height + HIDDEN;
String s = getParameter("coolinglimit");
if(s != null && s.endsWith("%"))
s = s.substring(0, s.length() - 1);
COOLING_LIMIT = s != null ? (PALETTE_SIZE * Integer.valueOf(s).intValue()) / 100 : (int)((double)PALETTE_SIZE * 0.5D);
s = getParameter("coolingrows");
if(s != null && s.endsWith("%"))
s = s.substring(0, s.length() - 1);
COOLING_ROWS = s != null ? (ROWS * Integer.valueOf(s).intValue()) / 100 : (int)((double)ROWS * 0.80000000000000004D);
s = getParameter("coolingfactor");
COOLING_FACTOR = s != null ? Integer.valueOf(s).intValue() : 2;
ROWS_RESEED = (int)((double)ROWS * 0.95999999999999996D);
s = getParameter("text");
message = s != null ? s : "";
s = getParameter("textfont");
textfont = s != null ? s : "TimesRoman";
s = getParameter("textsize");
textsize = s != null ? Integer.valueOf(s).intValue() : 18;
s = getParameter("textcolor");
textcolor = hexColor(s, Color.white);
Buffer = new byte[COLS * ROWS];
Buffer2 = new byte[COLS * ROWS];
for(int j = 0; j