All Packages Class Hierarchy This Package Previous Next Index
Class jHelp.htmlHelpFrame
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----java.awt.Frame
|
+----jHelp.htmlHelpFrame
- public final class htmlHelpFrame
- extends Frame
- implements ActionListener
This class provides a basic pop-up browser frame that contains Back, Forward
and Search buttons, in addition to an htmlHelpPanel component. Alternate constructors
permit specifying initial frame size and scrollbar width.
The htmlHelpFrame constructors require the instance of the parent container
as the first argument. This is used by jHelp to determine if the class is
being invoked by an applet or application. Standalone applications
invoking applet classes that deploy jHelp must supply the application Frame
to this constructor, and not the applet instance.
All constructors take a fileName argument, a String comprised of one or more
help source file names. Where more than one help file is being loaded in the
constructor, the names should be entered as a single string, with the file
names delimited by a '|' character.
For example
new htmlHelpFrame(this,"help1.html|help2.html|help3.html")
Help files need not be loaded during construction, and can be added using the
addFile method. However, this is not necessary, as new
files will be loaded automatically on demand if not already loaded.
The first file named in the fileNames argument will be the default file displayed
in the browser panel, unless specified otherwise.
You can instantiate an htmlHelpFrame with null as the fileNames argument, which
creates a blank display.
You can also instantiate an htmlHelpPanel with a zip or jar file, which should
contain the help documents that will be used.
-
htmlHelpFrame(Object, String)
- This class provides a basic pop-up browser frame that contains Back, Forward
and Search buttons, in addition to an htmlHelpPanel component.
-
htmlHelpFrame(Object, String, int)
- This constructor permits specifying the width of the scrollbar component.
-
htmlHelpFrame(Object, String, int, int)
- This constructor permits specifying an intial help frame size.
-
htmlHelpFrame(Object, String, int, int, int)
- This constructor permits specifying a scrollbar width as well as the initial size
of the pop-up frame.
-
htmlHelpFrame(Object, String, int, int, int, Locale)
- This constructor permits specifying a scrollbar width as well as the initial size
of the pop-up frame.
-
htmlHelpFrame(Object, String, int, int, Locale)
- This constructor permits specifying an intial help frame size.
-
htmlHelpFrame(Object, String, int, Locale)
- This constructor permits specifying the width of the scrollbar component.
-
htmlHelpFrame(Object, String, Locale)
- This class provides a basic pop-up browser frame that contains Back, Forward
and Search buttons, in addition to an htmlHelpPanel component.
-
actionPerformed(ActionEvent)
-
-
addFile(Object, String)
- The addFile method permits loading additional help source files subsequent
to construction.
-
addHTMLString(Object, String, String)
- The addHTMLString method permits loading dynamically generated HTML content.
-
getCurrentFileName()
- Returns the name of the current document.
-
getMaxCache()
- This method returns the current number of documents that will be retained in
memory.
-
resetStacks()
- This method can be called to force clearing/resetting the back/forward
navigation stacks.
-
setHelpIndex(htmlHelpIndexFrame)
- The setHelpIndex method assigns an htmlHelpIndexFrame object to this help frame
and enables the "Index" button.
-
setIndexButtonVisible(boolean)
- This method hides/shows the index button.
-
setJhelpListener(htmlJhelpListener)
- Sets an external listener, implementing htmlJhelpListener, that may
respond to the user hiding the htmlHelpFrame, or a low memory or other
exception, thrown when jHelp attempts to create the text image.
-
setMaxCache(int)
- This method permits setting a maximum number of help documents that are
retained in memory by jHelp.
-
setPrintButtonVisible(boolean)
- This method hides/shows the print button.
-
setPrinterEnabled(boolean)
- This method enables/disables the print button.
-
setShowBase(String)
- This method permits setting a help document path at runtime, so that the
show method can be used with a filename, rather than an explicit path when
it needs to be invoked.
-
setVisible(boolean)
- Hide the help frame
-
show()
- This overridden show method simply displays the current help file, at the current
document position.
-
show(String)
- This overridden show method permits the named help file to be displayed,
optionally at a specific NAME'd location within
the file.
-
show(String, int)
- This overridden show method permits the named help file to be displayed,
at a specific index location within the file.
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName)
- This class provides a basic pop-up browser frame that contains Back, Forward
and Search buttons, in addition to an htmlHelpPanel component. The initial
size of the pop-up is 320x400. An alternate public constructor can be used
to specify intial size, see below.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
Locale locale)
- This class provides a basic pop-up browser frame that contains Back, Forward
and Search buttons, in addition to an htmlHelpPanel component. The initial
size of the pop-up is 320x400. An alternate public constructor can be used
to specify intial size, see below.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int H_SIZE,
int V_SIZE)
- This constructor permits specifying an intial help frame size.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- H_SIZE - the initial width of the pop-up frame
- V_SIZE - the initial height of the pop-up frame
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int H_SIZE,
int V_SIZE,
Locale locale)
- This constructor permits specifying an intial help frame size.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- H_SIZE - the initial width of the pop-up frame
- V_SIZE - the initial height of the pop-up frame
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int scrollwidth)
- This constructor permits specifying the width of the scrollbar component. The
initial size of the pop-up is 320x400. An alternate public constructor can be
used to specify intial size, see below.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- scrollwidth - the width of the scrollbar
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int scrollwidth,
Locale locale)
- This constructor permits specifying the width of the scrollbar component. The
initial size of the pop-up is 320x400. An alternate public constructor can be
used to specify intial size, see below.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- scrollwidth - the width of the scrollbar
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int H_SIZE,
int V_SIZE,
int scrollwidth)
- This constructor permits specifying a scrollbar width as well as the initial size
of the pop-up frame.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- H_SIZE - the initial width of the pop-up frame
- V_SIZE - the initial height of the pop-up frame
- scrollwidth - the width of the vertical scrollbar
- See Also:
- addFile
htmlHelpFrame
public htmlHelpFrame(Object instance,
String fileName,
int H_SIZE,
int V_SIZE,
int scrollwidth,
Locale locale)
- This constructor permits specifying a scrollbar width as well as the initial size
of the pop-up frame.
This constructor also permits passing a Locale object, to override jHelp's default
behavior of getting the default Locale on the users machine.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileNames - a String of one or several help source files, separated by '|',
a null, or the name of a zip or jar file.
- H_SIZE - the initial width of the pop-up frame
- V_SIZE - the initial height of the pop-up frame
- scrollwidth - the width of the vertical scrollbar
- locale - a Locale object that jHelp will attempt to use in ResourceBundle.getBundle
- See Also:
- addFile
setHelpIndex
public void setHelpIndex(htmlHelpIndexFrame hi)
- The setHelpIndex method assigns an htmlHelpIndexFrame object to this help frame
and enables the "Index" button. When pressed, this will present an htmlHelpIndexFrame
which can be used to navigate topics and keywords that have been indexed with helper
application jHelpIndexBuilder.
- Parameters:
- hi - an htmlHelpIndexFrame object
addFile
public void addFile(Object instance,
String fileName)
- The addFile method permits loading additional help source files subsequent
to construction. However, unlike the constructor, only a single file can be
specified. This method need not be used in practice, although it continues
to be supported. Calling htmlHelpFrame.show(filename) will automatically
load the requested file if it is not in the document cache.
Note that adding a file does not place its contents in the display. It simply
loads the document into jHelp's document cache. You must still use
htmlHelpFrame.show(filename) to display the file.
Similar to this class's constructors, addFile requires the instance of the
parent container as the first argument. This is used by jHelp to determine
if the class is being invoked by an applet or application. Standalone applications
invoking applet classes that deploy jHelp must supply the application Frame
to this constructor, and not the applet instance.
The fileName argument is a String comprised of a single help source file.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- fileName - a String consisting of the name of one help source file.
addHTMLString
public void addHTMLString(Object instance,
String content,
String name)
- The addHTMLString method permits loading dynamically generated HTML content.
This method requires the String object containing the HTML to be displayed
and a name to be given to the object for referencing with the show() method.
If a name is not required (i.e. no external reference to this content will be
made) pass null as the name. In this case, future content can be added which
will replace the current content for dynamic HTML.
Note well that if you reference any external objects, such as images or links
to actual help files, you must define a <BASE HREF=...> if the referenced
objects are not within the current working directory of your application.
- Parameters:
- instance - the parent instance, should either be an applet or application Frame
- content - a String consisting of the HTML code to be displayed
- name - a String consisting of the name to be assigned the dynamic HTML object
with null passed as a name for disposable content.
show
public void show(String context)
- This overridden show method permits the named help file to be displayed,
optionally at a specific NAME'd location within
the file. The context argument takes the same form as an HREF, such as
help1.html#Usage, or simply #Usage. The latter form will attempt to find
the bookmark in the currently active help file.
If a context requests a file that has not been loaded, either in the constructor,
or with the addFile method, then jHelp will attempt to load the requested help
file.
- Parameters:
- context - the hyperlink to a file and/or bookmark
show
public void show(String filename,
int index)
- This overridden show method permits the named help file to be displayed,
at a specific index location within the file. It is primarily intended to
be used by htmlHelpIndexFrame. The specified file is assumed to be relative
to the current "showBase" setting.
- Parameters:
- filename - the name of the requested help document
- index - the index of the element to place at the top of the display
show
public void show()
- This overridden show method simply displays the current help file, at the current
document position.
- Overrides:
- show in class Window
setShowBase
public void setShowBase(String path)
- This method permits setting a help document path at runtime, so that the
show method can be used with a filename, rather than an explicit path when
it needs to be invoked. Note, that if this is used, then all subsequent
show(filenames) will prepend the specified base path to the named file. To
clear this base, call this method with null as the path argument.
If you have specified a zip or jar as the source of help files in the constructor
then this method is used to specify the path of help files within the zip.
This base can also be overridden by specifying a help document as an absolute
URL, prefixed with either file:// or http://
- Parameters:
- path - the directory (local or URL) where referenced help documents
are located
getCurrentFileName
public String getCurrentFileName()
- Returns the name of the current document.
setVisible
public void setVisible(boolean state)
- Hide the help frame
- Overrides:
- setVisible in class Component
actionPerformed
public void actionPerformed(ActionEvent e)
setMaxCache
public void setMaxCache(int value)
- This method permits setting a maximum number of help documents that are
retained in memory by jHelp. Useful for programs that deploy large sets of
help documents to prevent jHelp from exhausting resources if many documents
are browsed. A value of zero will cause jHelp to retain all documents in its
memory cache (the default.)
- Parameters:
- value - a positive integer representing the number of documents that
may be retained.
getMaxCache
public int getMaxCache()
- This method returns the current number of documents that will be retained in
memory. A value of zero indicates that all documents will be retained in the
memory cache.
setPrinterEnabled
public void setPrinterEnabled(boolean state)
- This method enables/disables the print button. By default, it is disabled
in applets, but this method can be used to override the default.
- Parameters:
- state - true or false, enables or disables the print button, respectively
setPrintButtonVisible
public void setPrintButtonVisible(boolean state)
- This method hides/shows the print button. By default, it is visible
but this method can be used to override the default.
- Parameters:
- state - true or false, shows or hides the print button, respectively
setIndexButtonVisible
public void setIndexButtonVisible(boolean state)
- This method hides/shows the index button. By default, it is visible
but this method can be used to override the default.
- Parameters:
- state - true or false, shows or hides the index button, respectively
resetStacks
public void resetStacks()
- This method can be called to force clearing/resetting the back/forward
navigation stacks. This will automatically disable the back/forward
button components as the stacks are emptied.
setJhelpListener
public void setJhelpListener(htmlJhelpListener l)
- Sets an external listener, implementing htmlJhelpListener, that may
respond to the user hiding the htmlHelpFrame, or a low memory or other
exception, thrown when jHelp attempts to create the text image.
- Parameters:
- l - an object implementing htmlJhelpListener
All Packages Class Hierarchy This Package Previous Next Index