For each JApplet you create in the following exercises, create an HTML host document named Test plus the JApplet name. For example, the host document for the JRiddle.java file is named TestJRiddle.html.
Create a JApplet that paints an ImageIcon the first time its paint() method is called, and then randomly draws small filled ovals in the background color over the image each time a JButton is clicked. The resulting effect is that the image seems to be erased by an increasing number of small overlapping ovals. For example, if you place an ImageIcon at the coordinates contained in variables named startPosX and startPosY, you can create a series of 15-by-10 filled ovals placed randomly on the ImageIcon’s surface using the following for loop:
for(int count = 0; count < 20; ++count)
{
int x = (int) (Math.random() * imageWidth) + startPosX;
int y = (int) (Math.random() * imageHeight) + startPosY;
g.fillOval(x, y, 10, 10);
}
Save the file as JEraseImage.java.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.