To make an application feel complete and to add support for the user you should always add a help system to your application. For this reason, Sun® offers the JavaHelp system which isn't too easy to use and does not look very attractive to the user. By using the library offered here, you will be able to add an attractive Windows® Vista® style help system to your application in no time!


The library

Everything you need to add a help system to your application is offered by the attached library jar file. All you need to do is add it to the classpath of your project.
The main features of the library:
  • library is easy to use and very small in size (~60 kB)
  • search function
  • user can change text size for better readability
  • pages can be printed out
  • you create the contents by writing simple HTML files
This is how it looks:

The library is shown on the left side of the picture. The right side shows the original help viewer of Windows® Vista®. Can you spot a difference?

Creating the contents

You decide what the contents of your help will be. Using any kind of HTML editor you simply have to write the HTML files. You will need at least an index page (for example 'index.htm'), one page for the table of contents (must be named 'toc.html') and one page which is reached through the 'Ask' button (must be named 'ask.html').
While creating the HTML pages you don't need to worry about formatting since the pages will automatically be CSS formatted in the viewer component. The following screenshot shows an example for a help page:
  1. <title>Was sind Updates</title>
  2. </head>
  3. <h1>Was sind Updates?</h1>
  4. <p>Updates sind aktualisierte oder ergänzende Softwareversionen,
  5. durch die Probleme verhindert oder behoben bzw. die Sicherheit oder
  6. Leistungsfähigkeit des Computers verbessert werden kann. Es wird
  7. dringend empfohlen, die Funktion für automatische Updates zu
  8. aktivieren, damit Sicherheitsupdates und andere wichtige bzw.
  9. empfohlene Updates für den Computer herunterladen werden können,
  10. sobald diese verfügbar sind.</p>
  11. <b>Siehe auch:</b>
  12. <li><a href="./aktivieren.html">Aktivieren oder Deaktivieren von
  13. automatischen Updates</a><br /></li>
  14. <li><a href="./version.html">Wie kann ich feststellen, ob der PC
  15. auf dem neuesten Stand ist?</a><br /></li>
  16. <li><a href="./faq.html">Updates: Häufig gestellte Fragen</a></li>
  17. </ul>
  18. </body>
  19. </html>

Adding the help system to your application

The following code snippet shows how to open the help viewer component from within your application:
  1. // The absolute path to the index file of your help must be given
  2. String path = System.getProperty("user.dir") +
  3. System.getProperty("file.separator") +
  4. "help" +
  5. System.getProperty("file.separator") +
  6. "index.html";
  7.  
  8. // Create an instance of the help viewer component
  9. VistaHelp help = new VistaHelp(path);
  10.  
  11. // Show the help window
  12. help.showHelp();
The result

Brief instructions:
1. Add the library (VistaHelp11.jar) to the classpath of your project.
2. Create the HTML files (ask.html and toc.html are mandatory!)
3. Open the viewer component through
VistaHelp help = new VistaHelp(...);
help.showHelp();

Find the library and an example help attached.