1 2 import java.awt.Font ; 3 import java.awt.GraphicsEnvironment ; 4 5 11 12 19 public class StubApp { 20 21 24 public StubApp() { 25 super(); 26 } 27 28 public void fontFind() { 29 GraphicsEnvironment g = GraphicsEnvironment 30 .getLocalGraphicsEnvironment(); 31 32 Font [] allFonts = g.getAllFonts(); 33 34 String str = "abc???"; 35 36 int x = 0; 37 38 for (x = 0; x < allFonts.length; x++) { 39 40 if (allFonts[x].canDisplayUpTo(str) == -1) { 41 42 System.out.println(allFonts[x].getFontName()); 43 44 break; 45 46 } 47 48 } 49 50 } 51 52 public static void main(String [] args) { 53 StubApp app = new StubApp(); 54 app.fontFind(); 55 } 56 } | Popular Tags |