Applicet Framework for Applets and Applications v2.03

be.arci.pub
Class SwingBrowser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.text.JTextComponent
                          |
                          +--javax.swing.JEditorPane
                                |
                                +--be.arci.pub.SwingBrowser
All Implemented Interfaces:
javax.accessibility.Accessible, Browser, java.util.EventListener, javax.swing.event.HyperlinkListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable

public class SwingBrowser
extends javax.swing.JEditorPane
implements Browser, javax.swing.event.HyperlinkListener

Implementation of Browser that uses a Swing JEditorPane to display HTML (and other) documents.

We supply this Browser implementation as a free service to all Applicet users. You are allowed to modify this source code, provided you move the class out of the be.arci package hierarchy.

Currently the sTarget argument is ignored.

A single SwingBrowser that is set as Browser displays all subsequent documents for Applicet.Context.showDocument(). If another Browser window is needed, a new SwingBrowser should be set as Applicet.Context's Browser. A SwingBrowser can be shared by multiple Applicet applications that run together.

Note: Swing 1.1.1 on JDK118 doesn't seem to support hyperlinks in frames.

Since:
25/jan/2000
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JEditorPane
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Inner classes inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SwingBrowser()
          Sets up a new SwingBrowser in a JDialog.
SwingBrowser(javax.swing.JLabel labHyperlink)
          Creates a SwingBrowser without adding it to a JDialog or any other containter; that is the responsibility of the caller.
 
Method Summary
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
          Processes HyperlinkEvents (i.e. clicking on a hyperlink) to display a new document; also displays the URL of the hyperlink under the mouse in the labHyperlink label.
 void setPage(java.net.URL page)
          Sets the current URL being displayed, and adjusts the title of our containing dialog to the new document url.
 void showDocument(Framework application, java.net.URL urlDocument, java.lang.String sTarget)
          Shows the document at the given URL in the Browser window or HTML frame indicated by sTarget.
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createDefaultEditorKit, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, getUIClassID, isFocusCycleRoot, isManagingFocus, paramString, processComponentKeyEvent, processKeyEvent, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, replaceSelection, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setText
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, isFocusTraversable, loadKeymap, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setDisabledTextColor, setDocument, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processFocusEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SwingBrowser

public SwingBrowser()
Sets up a new SwingBrowser in a JDialog.

SwingBrowser

public SwingBrowser(javax.swing.JLabel labHyperlink)
Creates a SwingBrowser without adding it to a JDialog or any other containter; that is the responsibility of the caller. A JLabel argument may be given to receive the URL of hyperlinks that the mouse cursor moves over.
Parameters:
labHyperlink - label to receive the URL of hyperlinks that the mouse cursor moves over; this argument may be null.
Method Detail

showDocument

public void showDocument(Framework application,
                         java.net.URL urlDocument,
                         java.lang.String sTarget)
Description copied from interface: Browser
Shows the document at the given URL in the Browser window or HTML frame indicated by sTarget. This code is called by an Applicet application's getAppletContext().showDocument(URL url), with sTarget = "_top" supplied as default, and by getAppletContext().showDocument(URL url, String sTarget). The sTarget argument is interpreted as follows:

"_self" Not applicable when running as application; acts the same as _top.
"_parent"Not applicable when running as application; acts the same as _top.
"_top" Show in the top-level frame of the current Browser window.
"_blank" Show in a new, unnamed top-level window.
name Show in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there.
Implementers may simply ignore the complete showDocument request (as per the java.applet.Applet.AppletContext specs!) or the sTarget argument.

Specified by:
showDocument in interface Browser
Following copied from interface: be.arci.applet.Browser
Parameters:
application - the Applicet application on behalf of which the document must be shown
urlDocument - the absolute url of the requested document (note: implementers may prefer to handle relative url's as well)
sTarget - name indicating where to display the document.
See Also:
Applicet.Context.showDocument, Viewing HTML documents

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent e)
Processes HyperlinkEvents (i.e. clicking on a hyperlink) to display a new document; also displays the URL of the hyperlink under the mouse in the labHyperlink label.
Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener

setPage

public void setPage(java.net.URL page)
             throws java.io.IOException
Sets the current URL being displayed, and adjusts the title of our containing dialog to the new document url.
Overrides:
setPage in class javax.swing.JEditorPane
See Also:
"javax.swing.JEditorPane.setPage(URL page)"

Applicet Framework for Applets and Applications v2.03