public class HtmlBrowser extends JPanel
If all you want to do is to show some URL, 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.
Modifier and Type | Class and Description |
---|---|
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.
|
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_HEIGHT
Preferred height of the browser
|
static int |
DEFAULT_WIDTH
Preferred width of the browser
|
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
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
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.
|
HtmlBrowser(HtmlBrowser.Factory fact,
boolean toolbar,
boolean statusLine,
Component extraToolbar)
Creates new html browser.
|
Modifier and Type | Method and Description |
---|---|
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.
|
getUI, getUIClassID, paramString, setUI, 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, 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, isValidateRoot, 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, 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, setLayout, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public HtmlBrowser()
public HtmlBrowser(boolean toolbar, boolean statusLine)
toolbar
- visibility of toolbarstatusLine
- visibility of statusLinepublic HtmlBrowser(HtmlBrowser.Factory fact, boolean toolbar, boolean statusLine)
fact
- Factory that is used for creation. If null is passed it searches for
a factory providing displayable component.toolbar
- visibility of toolbarstatusLine
- visibility of statusLinepublic HtmlBrowser(HtmlBrowser.Factory fact, boolean toolbar, boolean statusLine, Component extraToolbar)
fact
- Factory that is used for creation. If null is passed it searches for
a factory providing displayable component.toolbar
- visibility of toolbarstatusLine
- visibility of statusLineextraToolbar
- Additional toolbar to be displayed under the default
toolbar with location field and back/forward buttons.public static void setHomePage(String u)
u
- the home pagepublic static String getHomePage()
@Deprecated public static void setFactory(HtmlBrowser.Factory brFactory)
public void setURL(String str)
str
- URL to show in this browser.public void setURL(URL url)
url
- URL to show in this browser.public final URL getDocumentURL()
public final void setEnableHome(boolean b)
b
- public final void setEnableLocation(boolean b)
b
- public boolean isStatusLineVisible()
public void setStatusLineVisible(boolean v)
v
- public boolean isToolbarVisible()
public void setToolbarVisible(boolean v)
v
- public final HtmlBrowser.Impl getBrowserImpl()
public final Component getBrowserComponent()
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void requestFocus()
requestFocus
in class JComponent
public boolean requestFocusInWindow()
requestFocusInWindow
in class JComponent
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JPanel