< prev index next >

src/java.desktop/share/classes/java/awt/Toolkit.java

Print this page




1371                     public void setPlatformResources(ResourceBundle bundle) {
1372                         Toolkit.setPlatformResources(bundle);
1373                     }
1374                 });
1375 
1376         java.security.AccessController.doPrivileged(
1377                                  new java.security.PrivilegedAction<Void>() {
1378             public Void run() {
1379                 try {
1380                     resources = ResourceBundle.getBundle("sun.awt.resources.awt");
1381                 } catch (MissingResourceException e) {
1382                     // No resource file; defaults will be used.
1383                 }
1384                 return null;
1385             }
1386         });
1387 
1388         // ensure that the proper libraries are loaded
1389         loadLibraries();
1390         initAssistiveTechnologies();
1391         if (!GraphicsEnvironment.isHeadless()) {
1392             initIDs();
1393         }
1394     }
1395 
1396     /**
1397      * Gets a property with the specified key and default.
1398      * This method returns defaultValue if the property is not found.
1399      *
1400      * @param  key the key
1401      * @param  defaultValue the default value
1402      * @return the value of the property or the default value
1403      *         if the property was not found
1404      */
1405     public static String getProperty(String key, String defaultValue) {
1406         // first try platform specific bundle
1407         if (platformResources != null) {
1408             try {
1409                 return platformResources.getString(key);
1410             }
1411             catch (MissingResourceException e) {}
1412         }
1413 




1371                     public void setPlatformResources(ResourceBundle bundle) {
1372                         Toolkit.setPlatformResources(bundle);
1373                     }
1374                 });
1375 
1376         java.security.AccessController.doPrivileged(
1377                                  new java.security.PrivilegedAction<Void>() {
1378             public Void run() {
1379                 try {
1380                     resources = ResourceBundle.getBundle("sun.awt.resources.awt");
1381                 } catch (MissingResourceException e) {
1382                     // No resource file; defaults will be used.
1383                 }
1384                 return null;
1385             }
1386         });
1387 
1388         // ensure that the proper libraries are loaded
1389         loadLibraries();
1390         initAssistiveTechnologies();

1391         initIDs();

1392     }
1393 
1394     /**
1395      * Gets a property with the specified key and default.
1396      * This method returns defaultValue if the property is not found.
1397      *
1398      * @param  key the key
1399      * @param  defaultValue the default value
1400      * @return the value of the property or the default value
1401      *         if the property was not found
1402      */
1403     public static String getProperty(String key, String defaultValue) {
1404         // first try platform specific bundle
1405         if (platformResources != null) {
1406             try {
1407                 return platformResources.getString(key);
1408             }
1409             catch (MissingResourceException e) {}
1410         }
1411 


< prev index next >