Working with JavaHelp
I include the code to set up a link to the help file in one place. Note since JAWS converts each help.jar to DMhelp.jar, I look for the version with DM on the front.
Shared method to set up the link.
package com.halepringle.deliverprc
include java.help.*
/**
*
* Description - setUp Help - finds the help jar file and makes a connection to it. Shared
* @return - nothing
* @exceptions - none
*
*/
public void setUpHelp(){
try {
URL imgPath1 = CustEdit_Panel.class.getProtectionDomain().getCodeSource().getLocation();
String userdir = imgPath;
if (userdir.indexOf(".jar")> 0){
userdir = userdir.substring(0,userdir.lastIndexOf("/")+1);
}
String tmp1 = userdir+"RMDeliverHelp.jar";
if (new File(tmp1).exists()){
userdir = "file:"+tmp1;
}else{
userdir = "file:"+userdir+"RMDeliverHelp.jar";
}
// This must be done on Windows systems - can't hurt - GHP
userdir = userdir.replace('\\', '/');
URL x[] = { new URL(userdir) };
ClassLoader cl = new URLClassLoader(x);
String hsName = "DeliverHelp.hs";
URL hsURL = HelpSet.findHelpSet(cl, hsName);
hs = new HelpSet(null,hsURL);
hb = hs.createHelpBroker();
}
catch (Exception ee) {
JOptionPane.showMessageDialog(null,
"Help Set File Missing - DMDeliverHelp.jar", "Missing Help",
JOptionPane.ERROR_MESSAGE);
}
}
/**
*
* Description - get methods for Classes to find the Help system
* @return - HelpBroker - used by all classes that call HELP
*
*/
public HelpBroker getHelpSetBroker(){
return hb;
}