JavaHelp system components can be embedded directly into the application. The following pared down steps are taken from the idedemo sample program included with the JavaHelp release. A TOC navigator is added to the main application frame and the content pane is added to a tabbed display at the bottom of the main application frame. You can find the complete sources for the sample program at:
demos\src\sunw\demo\idedemo
try {
ClassLoader cl = ApiDemo.class.getClassLoader();
URL url = HelpSet.findHelpSet(cl, "api");
apiHS = new HelpSet(cl, url);
} catch (Exception ee) {
System.out.println ("API Help Set not found");
return;
}
JHelpContentViewer viewer1 = new JHelpContentViewer(apiHS);
messages.setComponentAt(miscTabIndex, viewer1); messages.setSelectedIndex(miscTabIndex);
xnav = (JHelpNavigator) apiHS.getNavigatorView("TOC").createNavigator(viewer1.getModel());
Use the same model for both the content pane and navigator
components (viewer1) so changes generated by one
component are reflected in the other component. Note that
the TOC can be created using either the HelpSet
getNavigatorView() method or the JavaHelpNavigator
getNavigatorView() method. Both methods produce
the same results, however using HelpSet reduces the
dependency on the GUI.
content.add(xnav, "Center"); classViewerIFrame.setContentPane(content);
See also: