With my helpset prepared as described in the last post I am ready to launch the javahelp viewer.
Given the opacity of the api pdf files, I decided that I needed to first implement a Java class that would open a help dialog. Once I have defined the required methods, it will be easier to recode in Clojure. It has been >10 years since I last thought about Java code so getting back in the swing (hah!) won’t be easy. When I last worked with the language generics and enums were yet to be defined.
I call my class OpenHelpDialog and don’t bother putting it in a package.
1 |
|
I navigate to its directory which is “/home/mbc/plate-manager/jws/pm/pmhelpclasses” and:
1 |
|
Note that I include the helpset directory in the classpath, as well as the helpclasses. Then run:
1 | java -cp /home/mbc/plate-manager/jws/pm/pmhelpclasses:/home/mbc/plate-manager/jws/pm/pmhelpset:/home/mbc/jh2.0/javahelp/lib/jhall.jar OpenHelpDialog |
Looks good. By default a MainWindow is displayed.
From the api pdf it looks like the main function of the HelpBroker is to enable objects (menu items, buttons, etc.) with the ability to launch the help viewer when a HelpActionListener is activated. Looking through the methods on HelpBroker I see hb.setDisplayed(true)
, which allows me to launch the viewer directly. A prior version of OpenHelpDialog had a button that was activated with the HelpBroker.enableHelpOnButton()
method. If I were writing in Java, that may be the preferred method, but I was uncertain how to utilize the HelpBroker that way in Clojure, given that I have another layer of abstraction between clojure and java - the seesaw gui classes.