RealSnow
/*
A Christmas gift from RealApplets
Http://www.realapplets.com
By Bavo Bruylandt
You are allowed to make changes as long as you
give me any credit for the surviving code :)
Enjoy!
*/
import java.awt.*;
import java.applet.*;
import java.net.*;
public class RealSnow extends Applet implements Runnable
{
Thread animThread;
Graphics buffG;
Image buff;
Image bgimage;
Dimension dim;
boolean running;
int delay= 40;
Wind [] winds;
Snow [] flakes;
int numberOfFlakes = 500;
int numberOfWinds = 0;
public void init()
{
setBackground(Color.black);
dim = getSize();
buff = createImage(dim.width,dim.height);
buffG = buff.getGraphics();
String bg = getParameter("Background");
numberOfFlakes = Integer.parseInt(getParameter("NumberOfFlakes"));
numberOfWinds = Integer.parseInt(getParameter("Turbulence"));
bgimage = getImage(getDocumentBase(),bg);
animThread = new Thread(this);
animThread.start();
running = true;
initWind();
initSnow();
}
private void initSnow()
{
flakes = new Snow [getNumberOfFlakes()];
for (int a=0;a flakes[a].getXco())
{
if (wind.getYco() < flakes[a].getYco() && wind.getYco()+wind.getHeight() > flakes[a].getYco())
{
flakes[a].dodge(wind.getSign()*wind.getStrength());
}
}
}
}
}
}
}
}
private void makeFlakes()
{
for (int a = 0;a<4;a++)
{
for (int b = 0;b
Return to index
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|