org.openide.awt
Class HtmlBrowser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.openide.awt.HtmlBrowser
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class HtmlBrowser
extends JPanel

Object that provides viewer for HTML pages.

If all you want to do is to show some URL in the IDE's normal way, this is overkill. Just use TopManager.showUrl(java.net.URL) instead. Using HtmlBrowser is appropriate mainly if you want to embed a web browser in some other GUI component (if the user has selected an external browser, this will fall back to a simple Swing renderer). Similarly BrowserComponent provides a dockable window with the same, and Impl (coming from a Factory) is the lower-level renderer itself (sans toolbar).

Summary: for client use, try TopManager.showUrl, or for more control or where embedding is needed, create an HtmlBrowser. For provider use, create a Factory and register an instance of it to lookup.

See Also:
Serialized Form

Inner Class Summary
static class HtmlBrowser.BrowserComponent
           
static interface HtmlBrowser.Factory
          Implementation of BrowerFactory creates new instances of some Browser implementation.
static class HtmlBrowser.Impl
          This interface represents an implementation of html browser used in HtmlBrowser.
 
Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
static int DEFAULT_HEIGHT
          Preferred height of the browser
static int DEFAULT_WIDTH
          Preferred width of the browser
 
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
HtmlBrowser()
          Creates new html browser with toolbar and status line.
HtmlBrowser(boolean toolbar, boolean statusLine)
          Creates new html browser.
HtmlBrowser(HtmlBrowser.Factory fact, boolean toolbar, boolean statusLine)
          Creates new html browser.
 
Method Summary
 AccessibleContext getAccessibleContext()
           
 URL getDocumentURL()
          Gets current document url.
static String getHomePage()
          Getter for the home page
 Dimension getPreferredSize()
          Returns preferred size.
 boolean isStatusLineVisible()
          Gets status line state.
 boolean isToolbarVisible()
          Gets status toolbar.
 void requestFocus()
           
 void setEnableHome(boolean b)
          Enables/disables Home button.
 void setEnableLocation(boolean b)
          Enables/disables location.
static void setFactory(HtmlBrowser.Factory brFactory)
          Deprecated. Use Lookup instead to register factories
static void setHomePage(String u)
          Sets the home page.
 void setStatusLineVisible(boolean v)
          Shows/hides status line.
 void setToolbarVisible(boolean v)
          Shows/hides toolbar.
 void setURL(String str)
          Sets new URL.
 void setURL(URL url)
          Sets new URL.
 
Methods inherited from class javax.swing.JPanel
getUIClassID, paramString, 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, 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, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, 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, addInputMethodListener, 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, getInputMethodRequests, 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, processInputMethodEvent, 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
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Preferred width of the browser

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Preferred height of the browser
Constructor Detail

HtmlBrowser

public HtmlBrowser()
Creates new html browser with toolbar and status line.

HtmlBrowser

public HtmlBrowser(boolean toolbar,
                   boolean statusLine)
Creates new html browser.

HtmlBrowser

public HtmlBrowser(HtmlBrowser.Factory fact,
                   boolean toolbar,
                   boolean statusLine)
Creates new html browser.
Parameters:
fact - Factory that is used for creation. Default factory is used if null is passed
toolbar - visibility of toolbar
statusLine - visibility of statusLine
Method Detail

setHomePage

public static void setHomePage(String u)
Sets the home page.
Parameters:
u - the home page

getHomePage

public static String getHomePage()
Getter for the home page
Returns:
the home page

setFactory

public static void setFactory(HtmlBrowser.Factory brFactory)
Deprecated. Use Lookup instead to register factories

Sets a new implementation of browser visual component for all HtmlBrowers.

setURL

public void setURL(String str)
Sets new URL.
Parameters:
str - URL to show in this browser.

setURL

public void setURL(URL url)
Sets new URL.
Parameters:
str - URL to show in this browser.

getDocumentURL

public final URL getDocumentURL()
Gets current document url.

setEnableHome

public final void setEnableHome(boolean b)
Enables/disables Home button.

setEnableLocation

public final void setEnableLocation(boolean b)
Enables/disables location.

isStatusLineVisible

public boolean isStatusLineVisible()
Gets status line state.

setStatusLineVisible

public void setStatusLineVisible(boolean v)
Shows/hides status line.

isToolbarVisible

public boolean isToolbarVisible()
Gets status toolbar.

setToolbarVisible

public void setToolbarVisible(boolean v)
Shows/hides toolbar.

getPreferredSize

public Dimension getPreferredSize()
Returns preferred size.
Overrides:
getPreferredSize in class JComponent

requestFocus

public void requestFocus()
Overrides:
requestFocus in class JComponent

getAccessibleContext

public AccessibleContext getAccessibleContext()
Overrides:
getAccessibleContext in class JPanel


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.