MVT API

mvt.help
Class HTMLBrowser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--mvt.help.HTMLBrowser
All Implemented Interfaces:
javax.accessibility.Accessible, java.util.EventListener, javax.swing.event.HyperlinkListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable

public class HTMLBrowser
extends javax.swing.JPanel
implements java.awt.print.Printable, javax.swing.event.HyperlinkListener

Creates an HTMLBrowser that suppors HTML 3.2. Must also add BrowserButton for support. To initialize this:

  • HTMLBrowser browser = new HTMLBrowser("file:///C:/help/");
  • BrowserButtons buttons = new BrowserButtons(browser);
  • brwoser.setButtons(buttons);

    Author:
    Parick Simek
    See Also:
    Serialized Form

    Nested Class Summary
     
    Nested classes inherited from class javax.swing.JPanel
    javax.swing.JPanel.AccessibleJPanel
     
    Nested classes inherited from class javax.swing.JComponent
    javax.swing.JComponent.AccessibleJComponent
     
    Nested classes inherited from class java.awt.Container
    java.awt.Container.AccessibleAWTContainer
     
    Nested classes inherited from class java.awt.Component
    java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
     
    Field Summary
     
    Fields inherited from class javax.swing.JComponent
    accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
     
    Fields inherited from class java.awt.Container
     
    Fields inherited from class java.awt.Component
    BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
     
    Fields inherited from interface java.awt.print.Printable
    NO_SUCH_PAGE, PAGE_EXISTS
     
    Fields inherited from interface java.awt.image.ImageObserver
    ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
     
    Constructor Summary
    HTMLBrowser(java.lang.String baseDir)
              Constructor for HTMLBrowser.
     
    Method Summary
     void back()
              If there is something in the history, go back.
     void forward()
              If there is something in the future, go forward, otherwise go forward.
     java.lang.String getHelp()
              Get the current homepage is set to.
     void gotoPage(java.lang.String URL)
              Go to a particular html page.
     void gotoPage(java.net.URL url)
              Go to a particular html page.
     boolean hasBackHistory()
              Test to see if there is a back history.
     boolean hasForwardHistory()
              Test to see if there is a forward history.
     void help()
              Go to the help section.
     void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt)
              The action taken when a hyperlink is pressed.
     int print(java.awt.Graphics pg, java.awt.print.PageFormat pageFormat, int pageIndex)
               
     void printHTML()
               
     void setButtons(BrowserButtons buttons)
              Sets the buttons that will be used.
     void setURL(java.lang.String URL)
              Views the URL given.
     void setURL(java.net.URL url)
              Views the URL given.
     
    Methods inherited from class javax.swing.JPanel
    getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
     
    Methods inherited from class javax.swing.JComponent
    addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
     
    Methods inherited from class java.awt.Container
    add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
     
    Methods inherited from class java.awt.Component
    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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Constructor Detail

    HTMLBrowser

    public HTMLBrowser(java.lang.String baseDir)
    Constructor for HTMLBrowser. Setup the viewer and buttons. Uses a BorderLayout, so when adding objects to this, make sure it is added to BorderLayout.WEST, BorderLayout.EAST or BorderLayout.SOUTH. Sets the viewer to BorderLayout.CENTER and the buttons to BorderLayout.NORTH.

    See Also:
    Method Detail

    setButtons

    public void setButtons(BrowserButtons buttons)
    Sets the buttons that will be used.

    See Also:
    tools.help.BrowserButtons

    gotoPage

    public void gotoPage(java.lang.String URL)
    Go to a particular html page.

    Parameters:
    URL - the webpage to be viewed.

    gotoPage

    public void gotoPage(java.net.URL url)
    Go to a particular html page.

    See Also:

    help

    public void help()
    Go to the help section.


    getHelp

    public java.lang.String getHelp()
    Get the current homepage is set to.

    Returns:
    the default homepage.

    hasForwardHistory

    public boolean hasForwardHistory()
    Test to see if there is a forward history.

    Returns:
    true if there is a forward history, otherwise false.

    hasBackHistory

    public boolean hasBackHistory()
    Test to see if there is a back history.

    Returns:
    true if there is a back history, otherwise false.

    back

    public void back()
    If there is something in the history, go back. Otherwise do nothing.


    forward

    public void forward()
    If there is something in the future, go forward, otherwise go forward.


    printHTML

    public void printHTML()

    print

    public int print(java.awt.Graphics pg,
                     java.awt.print.PageFormat pageFormat,
                     int pageIndex)
              throws java.awt.print.PrinterException
    Specified by:
    print in interface java.awt.print.Printable
    java.awt.print.PrinterException

    setURL

    public void setURL(java.lang.String URL)
    Views the URL given.

    Parameters:
    URL - the address that the html viewer will view.

    setURL

    public void setURL(java.net.URL url)
    Views the URL given.

    See Also:
    URL

    hyperlinkUpdate

    public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent evt)
    The action taken when a hyperlink is pressed.

    Specified by:
    hyperlinkUpdate in interface javax.swing.event.HyperlinkListener
    Parameters:
    evt - the event of a hyperlink being activated.

    MVT API

    mvt.icons