Skip to Main Content
Creating Effective JavaHelp
book

Creating Effective JavaHelp

by Kevin Lewis
June 2000
Intermediate to advanced content levelIntermediate to advanced
192 pages
4h 53m
English
O'Reilly Media, Inc.
Content preview from Creating Effective JavaHelp

Invoking Help with a Button, Menu Item, or Key

The simplest online help addition to any application is a menu item that starts the help system. Typically, a Help menu item is not context-sensitive: the help system always opens with the default help topic specified in the HelpSet file. The user can manually navigate through the TOC or search through the index or word-search index for other help topics.

Other standard ways to start the help system include clicking a Help button and pressing a Help key (by custom, function key F1). It’s up to you to decide which mechanism(s) to use. Follow these steps to add all three help activators to the TypeFacer example: menu item, button, and function key. Instead of writing new lines of code, you just need to uncomment (that is, remove the comment indicators from) lines that are already there. For this revision of the program, all the lines to be uncommented start with //#1. Use your text editor’s search command to locate these lines.

  1. Import the Java class library for JavaHelp:

    import javax.help.*;
  2. Create new instance variables for HelpSet-level classes, and for the Help menu item and Help button:

    HelpSet hs;
    HelpBroker hb;
    ...
    JButton    helpButton;
     ...
    JMenu helpMenu;
    JMenuItem helpItem;
  3. Create the Help menu item and button objects themselves:

    helpButton = new JButton("Help");
     ...
    buttonPanel.add(helpButton);
     ...
    helpMenu = new JMenu("Help");
    helpItem = new JMenuItem("Contents...");
    helpMenu.add(helpItem);
    ...
    menuBar.add(helpMenu);
  4. Activate the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Expert One-on-One™ J2EE™ Development without EJB™

Expert One-on-One™ J2EE™ Development without EJB™

Rod Johnson, Juergen Hoeller
Pro JavaFX 9: A Definitive Guide to Building Desktop, Mobile, and Embedded Java Clients

Pro JavaFX 9: A Definitive Guide to Building Desktop, Mobile, and Embedded Java Clients

Johan Vos, Stephen Chin, Weiqi Gao, James Weaver, Dean Iverson

Publisher Resources

ISBN: 1565927192Supplemental ContentCatalog PageErrata