Java Reference
In-Depth Information
Although this approach was fully functional, it is certainly not the ideal way of creating
a Help system. For example, to add to or change the help information, the source code of
the program needed to be modified. Also, the selection of the topic by number rather than
by name is tedious, and is not suitable for long lists of topics. Here, we will remedy these
shortcomings by creating a disk-based Help system.
The disk-based Help system stores help information in a help file. The help file is a
standard text file that can be changed or expanded at will, without changing the Help pro-
gram. The user obtains help about a topic by typing in its name. The Help system searches
the help file for the topic. If it is found, information about the topic is displayed.
1. Create the help file that will be used by the Help system. The help file is a standard
text file that is organized like this:
The name of each topic must be preceded by a #, and the topic name must be on a
line of its own. Preceding each topic name with a # allows the program to quickly
find the start of each topic. After the topic name are any number of information lines
about the topic. However, there must be a blank line between the end of one topic's
information and the start of the next topic. Also, there must be no trailing spaces at
the end of any help-topic lines.
Here is a simple help file that you can use to try the disk-based Help system. It stores
information about Java's control statements.
Search WWH ::




Custom Search