Container cp = getContentPane();
Panel top = new Panel();
top.setLayout(new FlowLayout());
fontNameChoice = new List(8);
top.add(fontNameChoice);
Toolkit toolkit = Toolkit.getDefaultToolkit();
// For JDK 1.1: returns about 10 names (Serif, SansSerif, etc.)
// fontList = toolkit.getFontList();
// For JDK 1.2: a much longer list; most of the names that come
// with your OS (e.g., Arial), plus the Sun/Java ones (Lucida,
// Lucida Bright, Lucida Sans...)
fontList = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getAvailableFontFamilyNames();
for (int i = 0; i < fontList.length; i++)
fontNameChoice.add(fontList[i]);
fontNameChoice.select(0);
fontSizeChoice = new List(8);
top.add(fontSizeChoice);
for (int i = 0; i < fontSizes.length; i++)
fontSizeChoice.add(fontSizes[i]);
fontSizeChoice.select(DEFAULT_SIZE);