import java.awt.*;
import java.applet.*;
/*<applet code="font" height=500 width=500></applet>*/
public class font extends Applet
{
Font f1,f2;
int a,b,c,d;
String s1,s2,s3,s4;
public void init()
{
f1=new Font("TimesRoman",Font.ITALIC,12);
f2=new Font("Helvetica",Font.BOLD+Font.ITALIC,14);
}
public void paint(Graphics g)
{
g.setFont(f1);
a=g.getFontMetrics().getAscent();
b=g.getFontMetrics().getDescent();
c=g.getFontMetrics().getLeading();
d=g.getFontMetrics().getHeight() ;
s1="Ascent:"+a;
s2="descent:"+b;
s3="leading:"+c;
s4="height:"+d;
g.drawString(s1,100,100);
g.drawString(s2,100,140);
g.drawString(s3,100,180);
g.drawString(s4,100,220);
g.setFont(f2);
g.drawString("thank u",200,270);
}
}
import java.applet.*;
/*<applet code="font" height=500 width=500></applet>*/
public class font extends Applet
{
Font f1,f2;
int a,b,c,d;
String s1,s2,s3,s4;
public void init()
{
f1=new Font("TimesRoman",Font.ITALIC,12);
f2=new Font("Helvetica",Font.BOLD+Font.ITALIC,14);
}
public void paint(Graphics g)
{
g.setFont(f1);
a=g.getFontMetrics().getAscent();
b=g.getFontMetrics().getDescent();
c=g.getFontMetrics().getLeading();
d=g.getFontMetrics().getHeight() ;
s1="Ascent:"+a;
s2="descent:"+b;
s3="leading:"+c;
s4="height:"+d;
g.drawString(s1,100,100);
g.drawString(s2,100,140);
g.drawString(s3,100,180);
g.drawString(s4,100,220);
g.setFont(f2);
g.drawString("thank u",200,270);
}
}
No comments:
Post a Comment