import java.applet.*;
import java.awt.*;
/*
<applet code=prg2
width=400 height=400
resize>
</applet>
*/
public class prg2 extends Applet
{
public void init()
{
int x,y;
//this.setSize(x,y);
}
public void paint(Graphics g)
{
int x,y,h;
String name="Sanjay Chauhan";
g.setColor(Color.magenta);
h=getHeight();
x=getWidth();
y=h;
int r=70;
int l=name.length();
l=l+1;
// g.drawString(String.valueOf(l),200,200);
g.drawString(name,0,10);
g.drawString(name,(x/2)-((l/2*6)),10);
// g.drawString(String.valueOf(x),300,300);
g.drawString(name,(x)-l*6,10);
g.drawString(name,0,y/2);
g.drawString(name,(x/2)-((l/2*6)),y/2);
g.drawString(name,x-l*6,y/2);
g.drawString(name,0,y);
g.drawString(name,(x/2)-((l/2*6)),y);
g.drawString(name,x=getWidth()-l*6,y);
}
}
import java.awt.*;
/*
<applet code=prg2
width=400 height=400
resize>
</applet>
*/
public class prg2 extends Applet
{
public void init()
{
int x,y;
//this.setSize(x,y);
}
public void paint(Graphics g)
{
int x,y,h;
String name="Sanjay Chauhan";
g.setColor(Color.magenta);
h=getHeight();
x=getWidth();
y=h;
int r=70;
int l=name.length();
l=l+1;
// g.drawString(String.valueOf(l),200,200);
g.drawString(name,0,10);
g.drawString(name,(x/2)-((l/2*6)),10);
// g.drawString(String.valueOf(x),300,300);
g.drawString(name,(x)-l*6,10);
g.drawString(name,0,y/2);
g.drawString(name,(x/2)-((l/2*6)),y/2);
g.drawString(name,x-l*6,y/2);
g.drawString(name,0,y);
g.drawString(name,(x/2)-((l/2*6)),y);
g.drawString(name,x=getWidth()-l*6,y);
}
}
Write an applet program that displays your name at nine corner of window.
Reviewed by Unknown
on
6:41 pm
Rating:
No comments: