graphics.copyArea(0, 0, w, h, 0, 1, Graphics.TOP | Graphics.LEFT);
graphics.setColor(0, 0, 0);
graphics.drawLine(0, 0, w, 0);
graphics.setColor(255, 255, 255);
for (int i = 0; i < w; ++i)
{
int test = Math.abs(random.nextInt()) % 100;
if (test < 5)
{
graphics.drawLine(i, 0, i, 0);
}
}
flushGraphics();
// Now wait...
try
{
Thread.sleep(sleepTime);
} catch (InterruptedException e)
{
}
}
}
// When the canvas is shown, start a thread to
// run the game loop.
protected void showNotify()
{
random = new Random();
thread = new Thread(this);
thread.start();
}
// When the game canvas is hidden, stop the thread.