Appendix D. TypeFacer.java Source Listing
This
appendix contains a listing of the
source file, TypeFacer.java
, for the Typeface
Tester application described in Chapter 7.
JavaHelp-related code appears in bold
.
/* * TypeFacer.java * A simple application for styling sample text. * * This application serves as the basis for JavaHelp demonstrations: * screen-level help, field-level help, and embedded help */ // ....................................... imports import java.awt.event.*; import java.awt.*; import java.util.Hashtable; import java.io.*; import java.net.*; import javax.swing.*; import javax.swing.border.*;import javax.help.*;
// ....................................... TypeFacer (frame) public class TypeFacer extends JFrame {// JavaHelp items
HelpSet hs;
HelpBroker hb;
// screen components JTextField inputField, displayField; JComboBox fontChoice, foreChoice, backChoice; JCheckBox boldBox, italicBox; JButton showButton, clearButton;JButton helpButton;
JButton qButton;
// embedded help components
JPanel helpPanel;
JHelpNavigator nav;
JHelpContentViewer viewer;
// menu components JMenu fileMenu, viewMenu; JMenuItem exitItem, typeItem, colorItem;JMenu helpMenu;
JMenuItem helpItem;
JMenuItem helpItemTOC;
JMenuItem embeddedItem;
// frame will contain a panel using the CardLayout manager CardLayout manager; JPanel cards; // fonts and colors for use in display box Hashtable fonts, colors; // combo box choices final String[] fontList = { "TimesRoman", "Helvetica", "Courier" }; final ...
Get Creating Effective JavaHelp now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.