The process of adding the JavaHelp system to your application is summarized in the following steps:
import javax.help.*;
jh.jar
) to your application's CLASSPATH.
try { URL hsURL = HelpSet.findHelpSet(null, "../help/myHelpSet.hs"); hs = new HelpSet(null, hsURL); } catch (Exception ee) { System.out.println("HelpSet "+helpsetName+" not found") return; }
hb = hs.createHelpBroker();
JMenu help = new JMenu("Help"); menuBar.add(help); menu_help = new JMenuItem(helpsetLabel); menu help.addActionListener(new CSH.DisplayHelpFromSource(mainHB));
The first thing your application does is read the HelpSet file specified by the application. The HelpSet file defines the HelpSet for that application. A HelpSet is the set of data that constitutes your help system. The HelpSet file includes the following information:
Map file | The map file is used to associate topic IDs with the URL or path name of HTML topic files. |
View information | Information that describes the navigators being used in the HelpSet. The standard navigators are: table of contents, index, and full-text search. Information about custom navigators is included here as well. |
HelpSet title | The name of the top-level TOC folder. |
Home ID | The name of the (default) ID that is displayed when the help viewer is called without specifying an ID. |
Sub-HelpSets | This optional section can be used to statically include other HelpSets using the tag. The HelpSets indicated using this tag are merged automatically into the HelpSet that contains the tag. More details about merging can be found in Merging HelpSets. |
For more information about the HelpSet file, see HelpSet File.
The HelpBroker is an agent that negotiates and manages the display of help content for your application. The HelpBroker also provides "convenience" methods that you can use to implement context-sensitive help. See Implementing Context-Sensitive Help for details.
You can implement a help system without using the HelpBroker. However, without the HelpBroker you have to write code to directly manage the HelpViewer and JHelp objects, navigators, and context-sensitive help functionality (F1 key on dialogs, help button activation, and on item help button/menu activation).
For a list and description of the HelpBroker methods, see the API at: doc\api\javax\help\HelpBroker.html.
See also: