- All Implemented Interfaces:
Styleable
,EventTarget
WebView
is a Node
that manages a
WebEngine
and displays its content. The associated WebEngine
is created automatically at construction time and cannot be changed
afterwards. WebView
handles mouse and some keyboard events, and
manages scrolling automatically, so there's no need to put it into a
ScrollPane
.
WebView
objects must be created and accessed solely from the
FX thread.
- Since:
- JavaFX 2.0
-
Property Summary
TypePropertyDescriptionfinal BooleanProperty
Specifies whether context menu is enabled.Specifies scale factor applied to font.final ObjectProperty
<FontSmoothingType> Specifies a requested font smoothing type : gray or LCD.Height of thisWebView
.Maximum height property.Maximum width property.Minimum height property.Minimum width property.final ObjectProperty
<Color> Specifies the background color of the web page.Preferred height property.Preferred width property.Width of thisWebView
.final DoubleProperty
The current zoom factor applied to the entire page contents.Properties declared in class javafx.scene.Parent
needsLayout
Properties declared in class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible
-
Field Summary
Fields declared in class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanProperty
Specifies whether context menu is enabled.Specifies scale factor applied to font.final ObjectProperty
<FontSmoothingType> Specifies a requested font smoothing type : gray or LCD.static List
<CssMetaData<? extends Styleable, ?>> Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its superclasses.List
<CssMetaData<? extends Styleable, ?>> This method should delegate toNode.getClassCssMetaData()
so that a Node's CssMetaData can be accessed without the need for reflection.final WebEngine
Returns theWebEngine
object.final double
Gets the value of thefontScale
property.final FontSmoothingType
Gets the value of thefontSmoothingType
property.final double
Gets the value of theheight
property.final double
Gets the value of themaxHeight
property.final double
Gets the value of themaxWidth
property.final double
Gets the value of theminHeight
property.final double
Gets the value of theminWidth
property.final Color
Gets the value of thepageFill
property.final double
Gets the value of theprefHeight
property.final double
Gets the value of theprefWidth
property.final double
getWidth()
Gets the value of thewidth
property.final double
getZoom()
Gets the value of thezoom
property.Height of thisWebView
.final boolean
Gets the value of thecontextMenuEnabled
property.final double
maxHeight
(double width) Called during layout to determine the maximum height for this node.Maximum height property.final double
maxWidth
(double height) Called during layout to determine the maximum width for this node.Maximum width property.final double
minHeight
(double width) Called during layout to determine the minimum height for this node.Minimum height property.final double
minWidth
(double height) Called during layout to determine the minimum width for this node.Minimum width property.final ObjectProperty
<Color> Specifies the background color of the web page.final double
prefHeight
(double width) Called during layout to determine the preferred height for this node.Preferred height property.final double
prefWidth
(double height) Called during layout to determine the preferred width for this node.Preferred width property.final void
setContextMenuEnabled
(boolean value) Sets the value of thecontextMenuEnabled
property.final void
setFontScale
(double value) Sets the value of thefontScale
property.final void
Sets the value of thefontSmoothingType
property.final void
setMaxHeight
(double value) Sets the value of themaxHeight
property.void
setMaxSize
(double maxWidth, double maxHeight) Convenience method for setting maximum width and height.final void
setMaxWidth
(double value) Sets the value of themaxWidth
property.final void
setMinHeight
(double value) Sets the value of theminHeight
property.void
setMinSize
(double minWidth, double minHeight) Convenience method for setting minimum width and height.final void
setMinWidth
(double value) Sets the value of theminWidth
property.final void
setPageFill
(Color value) Sets the value of thepageFill
property.final void
setPrefHeight
(double value) Sets the value of theprefHeight
property.void
setPrefSize
(double prefWidth, double prefHeight) Convenience method for setting preferred width and height.final void
setPrefWidth
(double value) Sets the value of theprefWidth
property.final void
setZoom
(double value) Sets the value of thezoom
property.Width of thisWebView
.final DoubleProperty
The current zoom factor applied to the entire page contents.Methods declared in class javafx.scene.Parent
computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
Methods declared in class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookup, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, queryAccessibleAttribute, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visibleProperty
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods declared in interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
width
Width of thisWebView
.- See Also:
-
height
Height of thisWebView
.- See Also:
-
zoom
The current zoom factor applied to the entire page contents.- Default value:
- 1.0
- Since:
- JavaFX 8.0
- See Also:
-
fontScale
Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.- Default value:
- 1.0
- See Also:
-
minWidth
Minimum width property.- See Also:
-
minHeight
Minimum height property.- See Also:
-
prefWidth
Preferred width property.- See Also:
-
prefHeight
Preferred height property.- See Also:
-
maxWidth
Maximum width property.- See Also:
-
maxHeight
Maximum height property.- See Also:
-
fontSmoothingType
Specifies a requested font smoothing type : gray or LCD. The width of the bounding box is defined by the widest row. Note: LCD mode doesn't apply in numerous cases, such as various compositing modes, where effects are applied and very large glyphs.- Default value:
- FontSmoothingType.LCD
- Since:
- JavaFX 2.2
- See Also:
-
pageFill
Specifies the background color of the web page.With this property, the
WebView
control's background can have any solid color, including some or complete level of transparency. However, if the HTML content being loaded sets its own background color, that color will take precedence.- Default value:
Color.WHITE
- Since:
- 18
- See Also:
-
contextMenuEnabled
Specifies whether context menu is enabled.- Default value:
- true
- Since:
- JavaFX 2.2
- See Also:
-
-
Constructor Details
-
WebView
public WebView()Creates aWebView
object.
-
-
Method Details
-
getEngine
Returns theWebEngine
object.- Returns:
- the WebEngine
-
getWidth
public final double getWidth()Gets the value of thewidth
property.- Property description:
- Width of this
WebView
. - Returns:
- the value of the
width
property - See Also:
-
widthProperty
Width of thisWebView
.- Returns:
- the width property
- See Also:
-
getHeight
public final double getHeight()Gets the value of theheight
property.- Property description:
- Height of this
WebView
. - Returns:
- the value of the
height
property - See Also:
-
heightProperty
Height of thisWebView
.- Returns:
- the height property
- See Also:
-
setZoom
public final void setZoom(double value) Sets the value of thezoom
property.- Property description:
- The current zoom factor applied to the entire page contents.
- Default value:
- 1.0
- Parameters:
value
- the value for thezoom
property- Since:
- JavaFX 8.0
- See Also:
-
getZoom
public final double getZoom()Gets the value of thezoom
property.- Property description:
- The current zoom factor applied to the entire page contents.
- Default value:
- 1.0
- Returns:
- the value of the
zoom
property - Since:
- JavaFX 8.0
- See Also:
-
zoomProperty
The current zoom factor applied to the entire page contents.- Default value:
- 1.0
- Returns:
- the zoom property
- Since:
- JavaFX 8.0
- See Also:
-
setFontScale
public final void setFontScale(double value) Sets the value of thefontScale
property.- Property description:
- Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.
- Default value:
- 1.0
- Parameters:
value
- the value for thefontScale
property- See Also:
-
getFontScale
public final double getFontScale()Gets the value of thefontScale
property.- Property description:
- Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.
- Default value:
- 1.0
- Returns:
- the value of the
fontScale
property - See Also:
-
fontScaleProperty
Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.- Default value:
- 1.0
- Returns:
- the
fontScale
property - See Also:
-
minWidth
public final double minWidth(double height) Called during layout to determine the minimum width for this node. -
minHeight
public final double minHeight(double width) Called during layout to determine the minimum height for this node. -
prefWidth
public final double prefWidth(double height) Called during layout to determine the preferred width for this node. -
prefHeight
public final double prefHeight(double width) Called during layout to determine the preferred height for this node.- Overrides:
prefHeight
in classNode
- Parameters:
width
- the width that should be used if preferred height depends on it- Returns:
- the preferred height that this node should be resized to during layout
- See Also:
-
maxWidth
public final double maxWidth(double height) Called during layout to determine the maximum width for this node. -
maxHeight
public final double maxHeight(double width) Called during layout to determine the maximum height for this node. -
minWidthProperty
Minimum width property.- Returns:
- the minWidth property
- See Also:
-
setMinWidth
public final void setMinWidth(double value) Sets the value of theminWidth
property.- Property description:
- Minimum width property.
- Parameters:
value
- the value for theminWidth
property- See Also:
-
getMinWidth
public final double getMinWidth()Gets the value of theminWidth
property.- Property description:
- Minimum width property.
- Returns:
- the value of the
minWidth
property - See Also:
-
minHeightProperty
Minimum height property.- Returns:
- the minHeight property
- See Also:
-
setMinHeight
public final void setMinHeight(double value) Sets the value of theminHeight
property.- Property description:
- Minimum height property.
- Parameters:
value
- the value for theminHeight
property- See Also:
-
getMinHeight
public final double getMinHeight()Gets the value of theminHeight
property.- Property description:
- Minimum height property.
- Returns:
- the value of the
minHeight
property - See Also:
-
setMinSize
public void setMinSize(double minWidth, double minHeight) Convenience method for setting minimum width and height.- Parameters:
minWidth
- the minimum widthminHeight
- the minimum height
-
prefWidthProperty
Preferred width property.- Returns:
- the prefWidth property
- See Also:
-
setPrefWidth
public final void setPrefWidth(double value) Sets the value of theprefWidth
property.- Property description:
- Preferred width property.
- Parameters:
value
- the value for theprefWidth
property- See Also:
-
getPrefWidth
public final double getPrefWidth()Gets the value of theprefWidth
property.- Property description:
- Preferred width property.
- Returns:
- the value of the
prefWidth
property - See Also:
-
prefHeightProperty
Preferred height property.- Returns:
- the prefHeight property
- See Also:
-
setPrefHeight
public final void setPrefHeight(double value) Sets the value of theprefHeight
property.- Property description:
- Preferred height property.
- Parameters:
value
- the value for theprefHeight
property- See Also:
-
getPrefHeight
public final double getPrefHeight()Gets the value of theprefHeight
property.- Property description:
- Preferred height property.
- Returns:
- the value of the
prefHeight
property - See Also:
-
setPrefSize
public void setPrefSize(double prefWidth, double prefHeight) Convenience method for setting preferred width and height.- Parameters:
prefWidth
- the preferred widthprefHeight
- the preferred height
-
maxWidthProperty
Maximum width property.- Returns:
- the maxWidth property
- See Also:
-
setMaxWidth
public final void setMaxWidth(double value) Sets the value of themaxWidth
property.- Property description:
- Maximum width property.
- Parameters:
value
- the value for themaxWidth
property- See Also:
-
getMaxWidth
public final double getMaxWidth()Gets the value of themaxWidth
property.- Property description:
- Maximum width property.
- Returns:
- the value of the
maxWidth
property - See Also:
-
maxHeightProperty
Maximum height property.- Returns:
- the maxHeight property
- See Also:
-
setMaxHeight
public final void setMaxHeight(double value) Sets the value of themaxHeight
property.- Property description:
- Maximum height property.
- Parameters:
value
- the value for themaxHeight
property- See Also:
-
getMaxHeight
public final double getMaxHeight()Gets the value of themaxHeight
property.- Property description:
- Maximum height property.
- Returns:
- the value of the
maxHeight
property - See Also:
-
setMaxSize
public void setMaxSize(double maxWidth, double maxHeight) Convenience method for setting maximum width and height.- Parameters:
maxWidth
- the maximum widthmaxHeight
- the maximum height
-
setFontSmoothingType
Sets the value of thefontSmoothingType
property.- Property description:
- Specifies a requested font smoothing type : gray or LCD. The width of the bounding box is defined by the widest row. Note: LCD mode doesn't apply in numerous cases, such as various compositing modes, where effects are applied and very large glyphs.
- Default value:
- FontSmoothingType.LCD
- Parameters:
value
- the value for thefontSmoothingType
property- Since:
- JavaFX 2.2
- See Also:
-
getFontSmoothingType
Gets the value of thefontSmoothingType
property.- Property description:
- Specifies a requested font smoothing type : gray or LCD. The width of the bounding box is defined by the widest row. Note: LCD mode doesn't apply in numerous cases, such as various compositing modes, where effects are applied and very large glyphs.
- Default value:
- FontSmoothingType.LCD
- Returns:
- the value of the
fontSmoothingType
property - Since:
- JavaFX 2.2
- See Also:
-
fontSmoothingTypeProperty
Specifies a requested font smoothing type : gray or LCD. The width of the bounding box is defined by the widest row. Note: LCD mode doesn't apply in numerous cases, such as various compositing modes, where effects are applied and very large glyphs.- Default value:
- FontSmoothingType.LCD
- Returns:
- the
fontSmoothingType
property - Since:
- JavaFX 2.2
- See Also:
-
setPageFill
Sets the value of thepageFill
property.- Property description:
- Specifies the background color of the web page.
With this property, the
WebView
control's background can have any solid color, including some or complete level of transparency. However, if the HTML content being loaded sets its own background color, that color will take precedence. - Default value:
Color.WHITE
- Parameters:
value
- the value for thepageFill
property- Since:
- 18
- See Also:
-
getPageFill
Gets the value of thepageFill
property.- Property description:
- Specifies the background color of the web page.
With this property, the
WebView
control's background can have any solid color, including some or complete level of transparency. However, if the HTML content being loaded sets its own background color, that color will take precedence. - Default value:
Color.WHITE
- Returns:
- the value of the
pageFill
property - Since:
- 18
- See Also:
-
pageFillProperty
Specifies the background color of the web page.With this property, the
WebView
control's background can have any solid color, including some or complete level of transparency. However, if the HTML content being loaded sets its own background color, that color will take precedence.- Default value:
Color.WHITE
- Returns:
- the
pageFill
property - Since:
- 18
- See Also:
-
setContextMenuEnabled
public final void setContextMenuEnabled(boolean value) Sets the value of thecontextMenuEnabled
property.- Property description:
- Specifies whether context menu is enabled.
- Default value:
- true
- Parameters:
value
- the value for thecontextMenuEnabled
property- Since:
- JavaFX 2.2
- See Also:
-
isContextMenuEnabled
public final boolean isContextMenuEnabled()Gets the value of thecontextMenuEnabled
property.- Property description:
- Specifies whether context menu is enabled.
- Default value:
- true
- Returns:
- the value of the
contextMenuEnabled
property - Since:
- JavaFX 2.2
- See Also:
-
contextMenuEnabledProperty
Specifies whether context menu is enabled.- Default value:
- true
- Returns:
- the
contextMenuEnabled
property - Since:
- JavaFX 2.2
- See Also:
-
getClassCssMetaData
Gets theCssMetaData
associated with this class, which may include theCssMetaData
of its superclasses.- Returns:
- the
CssMetaData
- Since:
- JavaFX 8.0
-
getCssMetaData
This method should delegate toNode.getClassCssMetaData()
so that a Node's CssMetaData can be accessed without the need for reflection.- Specified by:
getCssMetaData
in interfaceStyleable
- Overrides:
getCssMetaData
in classNode
- Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
-