devxlogo

See Which Fonts Are Installed With Your VM

See Which Fonts Are Installed With Your VM

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 

devx-admin

Share the Post: