Java Reference
In-Depth Information
L ISTING 11.1 Continued
11
}
}
private void initializeDefaultResources() {
//initializes the empty icon
java.awt.Graphics g = EMPTY_ICON.getImage().getGraphics();
g.drawLine(8,8,16,16);
g.drawLine(8,16,16,8);
}
public static ClassLoader getClassLoader(){
if (util==null)
getInstance();
return loader;
}
public static ImageIcon getImageIcon(String name){
if (util==null)
getInstance();
URL res = loader.getResource(name);
if (res!=null)
return new ImageIcon(res);
return EMPTY_ICON;
}
public static Object getService(String fullyQName){
Object service = null;
try {
service = ServiceManager.lookup(fullyQName);
} catch (UnavailableServiceException use) {
System.out.println(util.getClass()+”getService(“+ fullyQName +”) “+use);
}
return service;
}
public static BasicService getBasicService(){
if (util==null)
getInstance();
return basicService;
}
public static String getMsg(String key){
if (util==null)
getInstance();
if (util.msg!=null) {
String m = util.msg.getString(key);
if (m!=null)
return m;
}
return “”;
Search WWH ::




Custom Search