- java.lang.Object
-
- util.ui.HelpDialog
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.util.EventListener
,javax.swing.event.HyperlinkListener
public class HelpDialog extends java.lang.Object implements java.awt.event.ActionListener, javax.swing.event.HyperlinkListener
A help dialog which is able to show HTML pages that are located in a jar file.- Author:
- Til Schneider, www.murfman.de
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
HelpDialog.HistoryStackElement
protected class
HelpDialog.ScrollBarUpdater
-
Field Summary
Fields Modifier and Type Field Description static java.awt.Dimension
MAX_HELP_DIALOG_SIZE
The maximum size of the help dialog.static java.awt.Dimension
MIN_HELP_DIALOG_SIZE
The minimum size of the help dialog.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent evt)
protected void
addThisSiteToHistory()
helper method forhyperlinkUpdate
.protected static java.lang.String
extractPath(java.lang.String dateiname)
Extrahiert aus einem gegebenen Dateinamen den Pfad.void
hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt)
protected void
openSite(java.lang.String filename, java.lang.Class<?> clazz)
return content of a HTML page as string.protected void
popFromHistory()
helper method foractionPerformed(ActionEvent)
.protected void
setEditorText(java.lang.String text, double updateScrollBarTo)
Sets the text currently show.void
show()
static void
showHelpPage(java.awt.Component parent, java.lang.String filename, java.lang.Class<?> clazz)
Shows the specified site in the help dialog.
-
-
-
Method Detail
-
showHelpPage
public static void showHelpPage(java.awt.Component parent, java.lang.String filename, java.lang.Class<?> clazz)
Shows the specified site in the help dialog. If there is currently no help dialog shown, one is created.- Parameters:
parent
- If there is currently no help dialog shown, this parent is used for creating a new one.filename
- The name of the HTML file to show.clazz
- A class in the jar where the HTML file is in.
-
show
public void show()
-
setEditorText
protected void setEditorText(java.lang.String text, double updateScrollBarTo)
Sets the text currently show.- Parameters:
text
- The HTML text.updateScrollBarTo
- The relative position to scroll to. (Between 0 and 1)
-
addThisSiteToHistory
protected void addThisSiteToHistory()
helper method forhyperlinkUpdate
.adds the current page to the mHistoryStack.
-
popFromHistory
protected void popFromHistory()
helper method foractionPerformed(ActionEvent)
.return most current page of mHistoryStack.
-
openSite
protected void openSite(java.lang.String filename, java.lang.Class<?> clazz)
return content of a HTML page as string.Die Seite kann auch in der Jar-Datei sein, in dem diese Klasse ist.
- Parameters:
clazz
- A class in the jar where the HTML site is located.filename
- Der Dateiname der HTML-Seite.
-
extractPath
protected static java.lang.String extractPath(java.lang.String dateiname)
Extrahiert aus einem gegebenen Dateinamen den Pfad. Ist kein Pfad vorhanden, so wird null zurückgegeben.- Parameters:
dateiname
- Der Dateiname.- Returns:
- A String.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent evt)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
hyperlinkUpdate
public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt)
- Specified by:
hyperlinkUpdate
in interfacejavax.swing.event.HyperlinkListener
-
-