Java

Java Applet - To Change The Font Style Using Font Class

Java Applet - To Change The Font Style Using Font Class
import java.awt.*; 
import java.applet.*; 

public class fon extends Applet 
{ 
Font f1,f2,f3; 

public void init() 
{ 
f1 = new Font("Arial",Font.BOLD,18); 
f2 = new Font("Forte",Font.PLAIN,24); 
f3 = new Font("Elephant",Font.ITALIC,28); 
} 

public void paint(Graphics g) 
{ 
g.drawString("Senthil",50,50); 

g.setFont(f1); 
g.drawString("Velan",50,80); 

g.setFont(f2); 
g.drawString("Vicky",50,110); 

g.setFont(f3); 
g.drawString("Vignesh",50,140); 
} 
} 

/* <applet code = "fon.class" height = 500 width =500> 
</applet> */
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.