/*
Create Italic Font Example
This java example shows how to create italic font using Java AWT Font
class.
*/
import java.applet.Applet;
import java.awt.Font;
import java.awt.Graphics;
/*
<applet code="CreateItalicFontExample" width=200 height=200>
</applet>
*/
public class CreateItalicFontExample extends Applet{
public void paint(Graphics g) {
/*
* To create a italic font, use
* Font(String name,int style, int size)
* constructor of font class.
*
* sepcify Font.ITALIC as style.
*/
Font myFont = new Font("Courier", Font.ITALIC,20);
g.setFont(myFont);
g.drawString("Italic Font Example", 10, 50);
}
}
Example Output

Bookmark/Search this post with: