Font.ITALIC : Font « java.awt « Java by API






Font.ITALIC

 
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainClass extends JPanel {

  public void paint(Graphics g) {
      Font f = new Font ("Serif", Font.PLAIN, 12);
      g.setFont (f);
      g.drawString ("Serif - PLAIN - 12", 10, 30);

      f = new Font ("Sanserif", Font.ITALIC, 10);
      g.setFont (f);
      g.drawString ("Sanserif - ITALIC - 10", 10, 60);

      f = new Font ("Monospaced", Font.BOLD | Font.ITALIC, 14);
      g.setFont (f);
      g.drawString ("Monospaced - BOLD and ITALIC - 14", 10, 90);

      f = new Font ("Dialog", Font.PLAIN, 12);
      g.setFont (f);
      g.drawString ("Dialog - PLAIN - 12", 10, 120);

      f = new Font ("DialogInput", Font.BOLD + Font.ITALIC, 10);
      g.setFont (f);
      g.drawString ("DialogInput - BOLD and ITALIC - 10", 10, 150);
  }

  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new MainClass());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200,200);
    frame.setVisible(true);
  }
}
           
         
  








Related examples in the same category

1.Font.PLAIN
2.Font.BOLD | Font.ITALIC
3.Font.BOLD
4.Font.TRUETYPE_FONT
5.new Font(String name, int style, int size)
6.Font: createFont(int fontFormat, InputStream fontStream)
7.Font: createGlyphVector(FontRenderContext frc, String str)
8.Font: deriveFont(int style, float size)
9.Font: getFamily()
10.Font: getFontName()
11.Font: getLineMetrics(String str, FontRenderContext frc)
12.Font: getName()
13.Font: getStyle()
14.Font: getSize()
15.Font: getStringBounds(String str, FontRenderContext frc)