63 /** 64 * Get a valid FontManager implementation for the current platform. 65 * 66 * @return a valid FontManager instance for the current platform 67 */ 68 public static synchronized FontManager getInstance() { 69 70 if (instance != null) { 71 return instance; 72 } 73 74 AccessController.doPrivileged(new PrivilegedAction<Object>() { 75 76 public Object run() { 77 try { 78 String fmClassName = 79 System.getProperty("sun.font.fontmanager", 80 DEFAULT_CLASS); 81 ClassLoader cl = ClassLoader.getSystemClassLoader(); 82 Class<?> fmClass = Class.forName(fmClassName, true, cl); 83 instance = (FontManager) fmClass.newInstance(); 84 } catch (ClassNotFoundException | 85 InstantiationException | 86 IllegalAccessException ex) { 87 throw new InternalError(ex); 88 89 } 90 return null; 91 } 92 }); 93 94 return instance; 95 } 96 } | 63 /** 64 * Get a valid FontManager implementation for the current platform. 65 * 66 * @return a valid FontManager instance for the current platform 67 */ 68 public static synchronized FontManager getInstance() { 69 70 if (instance != null) { 71 return instance; 72 } 73 74 AccessController.doPrivileged(new PrivilegedAction<Object>() { 75 76 public Object run() { 77 try { 78 String fmClassName = 79 System.getProperty("sun.font.fontmanager", 80 DEFAULT_CLASS); 81 ClassLoader cl = ClassLoader.getSystemClassLoader(); 82 Class<?> fmClass = Class.forName(fmClassName, true, cl); 83 instance = 84 (FontManager) fmClass.getDeclaredConstructor().newInstance(); 85 } catch (ReflectiveOperationException ex) { 86 throw new InternalError(ex); 87 88 } 89 return null; 90 } 91 }); 92 93 return instance; 94 } 95 } |