In this tutorial how to work with fonts in an Applet in Core Java is shown.
Code:
FontDemo.java
/* <applet code=”FontDemo.class” width=”1000″ height=”1000″> </applet>*/
import java.awt.*;
import java.applet.*;
public class FontDemo extends Applet
{
public void paint(Graphics g)
{
Font currentFont = new Font(“Times Roman”,Font.ITALIC,20);
g.setFont(currentFont);
g.drawString(“Times Roman”,200,200);
currentFont = new Font(“Courier”,Font.BOLD+Font.ITALIC,72);
g.setFont(currentFont);
g.drawString(“Courier”,300,300);
}
}