Sometimes, it is useful to know which fonts are installed. This can differ from one Java Virtual Machine (JVM) implementation to another. The following code displays the names of all the fonts available on a particular JVM on the drawing context of a JLabel.
String [] fonts = getToolkit().getFontList(); Font font; int font_size = 12; int x = 20; int y = 25; int lineSpacing = 25; Graphics g = JLabel1.getGraphics(); //JLabel1 is a javax.swing.JLabel already defined, // and positioned on your GUI for (int i = 0; i < fonts.length; i++) { font = new Font(fonts[i], Font.BOLD, font_size); g.setFont(font); g.drawString(fonts[i], x, y); y += lineSpacing; }