Write a JApplet that draws a picture of a flower in spring u

Write a JApplet that draws a picture of a flower in spring. use drawRect(), drawLine(), drawOVAL(), fillRect(), fillOval().

Solution

The following are the steps followed in java applet to draw a flower in the applet

The first step is to Import the Java Declerations form Library

Declare the Length and bredth of applet with in the argument

declaring the arguments using the java statements

Drawing the size and the shapes of the flower with the coordinates

Then filling u with the color

declaring the message in the status bar

Kindly find the code as under

________________________________________________________________________________________________

Import Java.awt.*;

Import Java.applet.*;

/* <html>

<applet code = \"flower\" with = \"300\" height=\"300\"> </applet>

</html>

*/

public class flower extends Applet {

public void paint(Graghics g)

{

g.setColor(Color.blue);

g.drawOval(40,40,120,50);

g.drawOval(55,75,30,20);

g.drawOval(110,75,30,20);

g.filloval(68,81,10,10);

g.filloval(121,81,15,15);

g.drawOval(85,100,30,40);

showStatus(\" This is your flower\");

}

}

Write a JApplet that draws a picture of a flower in spring. use drawRect(), drawLine(), drawOVAL(), fillRect(), fillOval().SolutionThe following are the steps f

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site