62 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 } | 62 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 @SuppressWarnings("deprecation") 83 Object fmObject = Class.forName(fmClassName, true, cl).newInstance(); 84 instance = (FontManager) fmObject; 85 } catch (ClassNotFoundException | 86 InstantiationException | 87 IllegalAccessException ex) { 88 throw new InternalError(ex); 89 90 } 91 return null; 92 } 93 }); 94 95 return instance; 96 } 97 } |