Java如何获得可用的字体系列名称?
package org.nhooo.example.awt; import java.awt.Font; import java.awt.GraphicsEnvironment; public class FontFamilyNameList { public static void main(String[] args) { //从GraphicsEnvironment获取所有可用的字体系列名称 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String familyNames[] = ge.getAvailableFontFamilyNames(); //迭代familyNames数组以显示可用字体的姓氏 for (String familyName : familyNames) { System.out.println("Family names: " + familyName); } } }