Executed only in application.
JFrame f = new JFrame("FontDemo");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
FontPanel fontPanel = new FontPanel();
f.getContentPane().add(fontPanel, BorderLayout.CENTER);
f.setSize(550, 200);
f.setVisible(true);