I want to put a custom font using drawString method in my applet the problem is that it doesn't change the font even I do it properly. I am still student so please bare at me for my code. Please help me to change the font. I found out that there are certain fonts that java allowed to use in method font please help me.
import javax.swing.*;
import java.awt.*;
public class WoodyWoodPeckerShow extends JApplet {
private Font font;
public void init(){
setFont(new Font("WoodPecker",Font.TRUETYPE_FONT,30));
}
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
g2.setFont(font);
g2.drawString("WoodyWoodPecker",10,200);
}
}
It gives me the default font instead of like this
Please help me. Thank you guys. Hope you can help me :)