Wednesday, 21 December 2016

wap in java to draw umbrella with event handling...

/*<applet code=mass.class width=1500 height=700>
</applet>*/


import java.awt.*;
import java.applet.*;
public class mass extends Applet{
int  r,g1,b;
Color c;
public void paint (Graphics g){


r=(int) (Math.round (Math.random()*225));
g1=(int) (Math.round (Math.random()*225));
b=(int) (Math.round (Math.random()*225));
c=new Color(r,g1,b);
setBackground (Color.pink);
setForeground (Color.red);
g.drawString("colorfull umbrella",160,250);
g.setColor (c);
g.fillArc(50,50,450,450,0,180);
g.setColor  (Color.blue);
g.drawLine (270,275,270,515);
g.drawArc(269,475,79,80,0,-180);
try{
Thread.sleep(2500);
g.clearRect(0,0,270,400);
repaint();
}
catch(Exception e){}
}}

5 comments:

  1. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. best golf umbrella

    ReplyDelete