org.openide.awt
Class HtmlBrowser

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.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 HtmlBrowser.URLDisplayer.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 Impl (coming from a Factory) is the lower-level renderer itself (sans toolbar).

Summary: for client use, try URLDisplayer.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

Nested Class Summary
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.
static class HtmlBrowser.URLDisplayer
          A manager class which can display URLs in the proper way.
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
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()
           
 Component getBrowserComponent()
          Get the browser component.
 HtmlBrowser.Impl getBrowserImpl()
          Get the browser implementation.
 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()
           
 boolean requestFocusInWindow()
           
 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
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, 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, 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
 

Field Detail

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Preferred width of the browser

See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Preferred height of the browser

See Also:
Constant Field Values
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:
url - 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.


getBrowserImpl

public final HtmlBrowser.Impl getBrowserImpl()
Get the browser implementation.

Returns:
the implementation
Since:
org.openide/1 4.27

getBrowserComponent

public final Component getBrowserComponent()
Get the browser component.

Returns:
a component or null
Since:
org.openide/1 4.27

getPreferredSize

public Dimension getPreferredSize()
Returns preferred size.


requestFocus

public void requestFocus()

requestFocusInWindow

public boolean requestFocusInWindow()

getAccessibleContext

public AccessibleContext getAccessibleContext()

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.