Program to display available fonts :
package com.hubberspot.graphics.example;
import java.awt.*;
import javax.swing.*;
public class FontsInfo
{
JFrame frame;
JTextArea textarea;
FontsInfo()
{
frame = new JFrame();
frame.setLayout(new FlowLayout());
textarea = new JTextArea();
String[] font = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
String temp = "";
for (String name : font)
{
temp = temp + name+"\n";
}
textarea.setText(temp);
frame.add(textarea);
frame.setTitle("Welcome to Hubberspot!.");
frame.setSize(300,600);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args)
{
new FontsInfo();
}
}
Output of the program :
