1 package discRack; 2 3 import java.awt.*; 4 import java.util.*; 5 import java.text.*; 6 import java.net.URL ; 7 import javax.accessibility.*; 8 9 16 public class ResourceManager { 17 private static final String resourcePath= 18 "discRack.resources.DiscRack"; 19 20 public static ResourceBundle defaultResource; 21 22 23 static { 24 try { 25 defaultResource = ResourceBundle. 26 getBundle(resourcePath); 27 } 28 catch (MissingResourceException mre) { 29 System.err.println(resourcePath+".properties not found"); 30 System.exit(1); 31 } 32 } 33 34 44 public static String getResourceString (String nm) { 45 String str; 46 try { 47 str=defaultResource.getString(nm); 48 } catch (MissingResourceException mre1) { 49 str = null; 50 } 51 return str; 52 } 53 54 60 public static URL getResource (String key) { 61 String name = getResourceString(key); 62 if (name != null) { 63 URL url = ResourceManager.class.getClassLoader().getResource(name); 64 return url; 65 } 66 return null; 67 } 68 } | Popular Tags |