Question: Write a Java applet for a screen saver with at least 5 moving shapes with different colors. Example: import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public

Write a Java applet for a screen saver with at least 5 moving shapes with different colors.

Example:

import java.applet.Applet;

import java.awt.Color;

import java.awt.Graphics;

public class Javaapp extends Applet {

public void paint(Graphics g) {

int a=150,b=150,c=10,d=10;

g.setColor(Color.red);

for(int i=0;i<15;i++)

{

try{

Thread.sleep(1000);

}catch(InterruptedException ex){}

g.drawOval(a, b, c, d);

a-=10;

b-=10;

c+=8;

d+=8;

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!