//******************************************************************************
// gramin03.for.java: Applet
//
//******************************************************************************
// |] 4 |\| |\|
import java.applet.*;
import java.awt.*;
public class gramin03 extends Applet
{
int iMaxX,
iMaxY;
private AudioClip sndStart,
sndStop;
public gramin03()
{
// TODO: Add constructor code here
}
public String getAppletInfo()
{
return "Name: gramin03\r\n" +
"Author: \r\n" +
"Created with Microsoft Visual J++ Version 6.0";
}
public void init()
{
iMaxX = 255;
iMaxY = 255;
resize( iMaxX, iMaxY );
sndStart = getAudioClip (getDocumentBase(), "tada.au" );
sndStart = getAudioClip (getDocumentBase(), "oops.au" );
// TODO: Place additional initialization code here
}
public void paint(Graphics g)
{
g.setColor ( new Color ( 0, 0, 0 ) );
g.fillRect ( 0, 0, iMaxX, iMaxY );
//Border
for ( int i = 0 ; i < 25 ; i++ )
{
g.setColor ( new Color ( 10*i, 0, 0 ));
g.drawRect ( i, i, iMaxX-i-i-1, iMaxY-i-i-1);
}
sndStart.play();
for ( int i = 0 ; i < 17 ; i++ )
{
if (i == 16)
{
g.setColor ( new Color ( 128, 0, 0 ));
g.fillOval ( 30+10*i, 40+10*i, 15, 15 );
}
else {
g.setColor ( new Color ( 128, 0, 0 ));
g.fillOval ( 30+10*i, 40+10*i, 15, 15 );
try { Thread.sleep ( 100 ); }
catch ( InterruptedException ex )
{ stop(); }
g.setColor ( new Color ( 0, 0, 0 ));
g.fillOval ( 30+10*i, 40+10*i, 15, 15 );
}
}
sndStop.play();
}
public void start() { }
public void stop()
{
sndStart.stop();
sndStop.stop();
}
}