public class HelpBox
extends javax.swing.JScrollPane
Modifier and Type | Class and Description |
---|---|
protected class |
HelpBox.AnchorInfo |
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected java.util.HashMap<java.lang.String,HelpBox.AnchorInfo> |
anchorTable
Map from anchors in the HTML (that is, <a id='name' ...>)
to the character position in the document.
|
static int |
BOX_HEIGHT |
static int |
BOX_WIDTH |
static javax.swing.KeyStroke |
F1 |
static boolean |
GRAB_MOUSE
GRAB_MOUSE, NO_GRAB_MOUSE arguments to showHelpbox
so its argument is not mis-interpreted as visibility
|
static java.lang.String |
NAMEKEY |
static boolean |
NO_GRAB_MOUSE
GRAB_MOUSE, NO_GRAB_MOUSE arguments to showHelpbox
so its argument is not mis-interpreted as visibility
|
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
Modifier and Type | Method and Description |
---|---|
void |
addF1(javax.swing.JComponent comp)
Cause the component to respond to F1 by showing the HelpBox.
|
javax.swing.JMenuItem |
addHelpMenuItem(javax.swing.JMenu h)
Adds menu item Help to a JMenu.
|
static HelpBox |
create()
Construct an empty HelpBox.
|
static HelpBox |
create(java.lang.Class<?> aClass,
java.lang.String locator,
java.net.URL base)
Create a HelpBox and load it from a file.
|
void |
dumpAnchorTable(PrintStream outstr) |
void |
fixAnchorTable()
Fill in the global HashMap 'anchorTable'
with map from anchor point names to locations
CASE SENSITIVE
This method must be called after loading the help document.
|
javax.swing.JFrame |
getFrame() |
HTMLPane |
getHelpViewer() |
java.awt.Rectangle |
getScreenBounds() |
static java.awt.Dimension |
getScreenSize(java.awt.Component comp)
Utility method to find the screen size of the screen
where a component is displayed.
|
javax.swing.JFrame |
getWindow() |
void |
grabMouse()
Move the mouse to the upper left corner of this HelpBox.
|
boolean |
isLeashed(int x,
int y) |
void |
leashTo(java.awt.Rectangle r)
Turn off autoscrolling until mouse has moved
at least LEASHLENGTH pixels away from rectangle r
|
static void |
main(java.lang.String[] args) |
int |
offsetFor(java.lang.String name) |
void |
processHTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent e) |
protected void |
scrollToOffset(int off)
Scroll the help document to a given offset.
|
void |
scrollToTarget(java.lang.String name) |
void |
sensitize(java.awt.Component c,
java.lang.String n)
Add a mouse listener to a component that will call scrollToOffset.
|
void |
sensitizeTree(java.awt.Component c,
java.lang.String n)
Assign a name to a component and all subcomponents.
|
void |
setScreenBounds(int x,
int y,
int width,
int height)
Set the location of a window opened by a menu item.
|
void |
showHelpBox(boolean grab)
Cause this HelpBox to become visible at the location in screenBounds.
|
void |
showHelpBox(boolean grab,
int scrollPos)
Cause this HelpBox to become visible at the location in screenBounds.
|
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final javax.swing.KeyStroke F1
public static final java.lang.String NAMEKEY
public static final boolean GRAB_MOUSE
public static final boolean NO_GRAB_MOUSE
public static final int BOX_HEIGHT
public static final int BOX_WIDTH
protected java.util.HashMap<java.lang.String,HelpBox.AnchorInfo> anchorTable
public HTMLPane getHelpViewer()
public javax.swing.JFrame getWindow()
public static HelpBox create()
public static HelpBox create(java.lang.Class<?> aClass, java.lang.String locator, java.net.URL base)
aClass
- a Class loaded from the ClassLoader containing the
document to load. May be null if not loading from resource: or jardir:locator
- a locator suitable for IOUtils.getInputStreambase
- an URL indicating where the embedded images are located.
If null, images are expected to be in the same location as the locatorpublic javax.swing.JFrame getFrame()
public void processHTMLFrameHyperlinkEvent(javax.swing.text.html.HTMLFrameHyperlinkEvent e)
public void fixAnchorTable()
public void sensitize(java.awt.Component c, java.lang.String n)
c
- The componentn
- The name for the componentpublic void sensitizeTree(java.awt.Component c, java.lang.String n)
c
- The componentn
- The name for the component and its subcomponents.public boolean isLeashed(int x, int y)
public void scrollToTarget(java.lang.String name)
public int offsetFor(java.lang.String name)
protected void scrollToOffset(int off)
off
- The offset of the document character to be on the top display.public void dumpAnchorTable(PrintStream outstr)
public void setScreenBounds(int x, int y, int width, int height)
x
- Window top relative to screen top of 0y
- Window left relative to screen left of 0width
- Window widthheight
- Window heightpublic java.awt.Rectangle getScreenBounds()
public void grabMouse()
public void leashTo(java.awt.Rectangle r)
r
- The boundary rectanglepublic javax.swing.JMenuItem addHelpMenuItem(javax.swing.JMenu h)
h
- The JMenu to be augmented.public void addF1(javax.swing.JComponent comp)
comp
- The JComponent to activate for F1 help.public static java.awt.Dimension getScreenSize(java.awt.Component comp)
comp
- the Component whose screen size is wanted.public void showHelpBox(boolean grab)
grab
- Whether to warp the mouse to the newly opened windowpublic void showHelpBox(boolean grab, int scrollPos)
grab
- Whether to warp the mouse to the newly opened windowscrollPos
- A position to be scrolled to the top of the helpbox window.
No scroll is done if this value is less than zeropublic static void main(java.lang.String[] args)