This repository was archived by the owner on Jan 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathembed.html
More file actions
75 lines (72 loc) · 2.96 KB
/
embed.html
File metadata and controls
75 lines (72 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--
* Copyright © 2003 Sun Microsystems, Inc
* All rights reserved.
* Notice of copyright on this source code
* product does not indicate publication.
*
* RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by
* the U.S. Government is subject to restrictions as set forth
* in subparagraph (c)(1)(ii) of the Rights in Technical Data
* and Computer Software Clause at DFARS 252.227-7013 (Oct. 1988)
* and FAR 52.227-19 (c) (June 1987).
* Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A.
*
-->
<html>
<head>
<title>Embedding JavaHelp Components</title>
<link rel="stylesheet" type="text/css" href="../jhug.css" title="Style">
</head>
<body bgcolor="#ffffff">
<h2>Embedding JavaHelp Components</h2>
<p> JavaHelp system components can be embedded directly into the application.
The following pared down steps are taken from the idedemo sample program included
with the JavaHelp software release. A TOC navigator is added to the main application
frame and the content pane is added to a tabbed display at the bottom of the
main application frame. You can find the complete sources for the sample program
at:
<pre> demos\src\sunw\demo\idedemo</pre>
<ol>
<li>Find the helpset file and create the <code>HelpSet</code> object:
<pre>try {
ClassLoader cl = ApiDemo.class.getClassLoader();
URL url = HelpSet.findHelpSet(cl, "api");
apiHS = new HelpSet(cl, url);
} catch (Exception ee) {
System.out.println ("API Help Set not found");
return;
}</pre>
<li>Create the content pane:
<pre>JHelpContentViewer viewer1 = new JHelpContentViewer(apiHS);
</pre>
<li>Add the content pane to a container:
<pre>messages.setComponentAt(miscTabIndex, viewer1);
messages.setSelectedIndex(miscTabIndex);
</pre>
<li>Create a navigator (TOC):
<pre>xnav = (JHelpNavigator) apiHS.getNavigatorView("TOC").createNavigator(viewer1.getModel());</pre>
<li>
<p> Use the same model for both the content pane and navigator components
(viewer1) to ensure that changes generated by one component are reflected
in the other component. Note that the TOC can be created by using either
the <code>HelpSet.getNavigatorView()</code> method or the <code>JavaHelpNavigator.getNavigatorView()</code>
method. Both methods produce the same results; however, using <code>HelpSet</code>
reduces the dependency on the GUI. </p>
</li>
<br>
<li>Add the navigator to the container:
<pre>content.add(xnav, "Center");
classViewerIFrame.setContentPane(content);</pre>
</ol>
<p>
<img src="../../images/hg_see.gif" width="18" height="13"><b>See also:</b>
<dl>
<dd><a href="dev.html">Programming with the JavaHelp System</a>
<dd><a href="basics.html">Adding the JavaHelp System to Applications</a>
<dd><a href="csh.html">Implementing Context-Sensitive Help</a>
</dl>
<br>
</body>
</html>