import java.awt.BorderLayout; 
import java.awt.Color; 
import java.awt.Font; 
import java.awt.Graphics2D; 
import java.awt.GraphicsConfiguration; 
import java.awt.image.BufferedImage; 

import javax.swing.ImageIcon; 
import javax.swing.JFrame; 
import javax.swing.JLabel; 

public class SimpleFontTest { 
private static Font FONT = new Font("Impact", Font.ITALIC, 18); 
private static String TEXT = "The Quick Brown Fox"; 

public static void main(String args[]){	
if (args.length > 0 && args[0] != null) { 
String fontName = args[0]; 
FONT = new Font(fontName, Font.ITALIC, 18); 
} 

JFrame f = new JFrame("Simple Font Test: " + System.getProperty("java.vendor")); 
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 

JLabel label = new JLabel("JLabel: " + TEXT); 
label.setFont(FONT); 

System.out.println(System.getProperty("java.vendor")); 
System.out.println(System.getProperty("java.version")); 

GraphicsConfiguration gc = f.getGraphicsConfiguration(); 
BufferedImage image = gc.createCompatibleImage(400, 50); 
Graphics2D g = image.createGraphics(); 
g.setFont(FONT); 
g.setColor(Color.BLACK); 
g.setBackground(Color.WHITE); 
g.clearRect(0, 0, image.getWidth(), image.getHeight()); 
g.drawString("BufferedImage: " + TEXT, 10, 15); 
g.dispose(); 
JLabel picLabel = new JLabel(new ImageIcon(image)); 

f.add(label, BorderLayout.PAGE_START); 
f.add(picLabel, BorderLayout.CENTER); 
f.setSize(400, 200); 
f.setVisible(true); 
} 
} 