Splash
{
int XMAX = 112;
float[] m_Height = new float[XMAX] ; //current height
float[] m_G = new float[XMAX] ; //move value before
float b = 1.01f ; //load factor
float fWeight = 3 ; //wave speed
public void paint(Graphics g)
{
int i ;
float a, w3, w3_2 ;
float fWk ;
g.setColor( Color.blue ) ;
w3 = 3 * fWeight ;
w3_2 = w3 - 2 ;
m_Height[0] = m_Height[1] ;
m_Height[(XMAX-1)] = m_Height[(XMAX-2)] ;
a = m_Height[0] ;
for ( i = 1 ; i < (XMAX-1) ; i++ ) {
fWk = ((a + w3_2 * m_Height[i] + m_Height[i+1]) / w3 + m_G[i]) / b ;
a = m_Height[i] ;
m_G[i] = fWk - a ;
m_Height[i] = fWk ;
g.clearRect( (i-1)*4, (int)fWk-30, 4, 60 ) ;
g.fillRect( (i-1)*4, (int)fWk+30, 4, 60 ) ;
}
}
public void update(Graphics g)
{
paint(g);
}
}
Back to the Splash applet page
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.
|