- 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 SummaryPropertiesTypePropertyDescriptionfinal BooleanPropertySpecifies 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 DoublePropertyThe current zoom factor applied to the entire page contents.Properties declared in class javafx.scene.ParentneedsLayoutProperties declared in class javafx.scene.NodeaccessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, 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 SummaryFields declared in class javafx.scene.NodeBASELINE_OFFSET_SAME_AS_HEIGHT
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal BooleanPropertySpecifies 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 theCssMetaDataassociated with this class, which may include theCssMetaDataof 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 WebEngineReturns theWebEngineobject.final doubleGets the value of thefontScaleproperty.final FontSmoothingTypeGets the value of thefontSmoothingTypeproperty.final doubleGets the value of theheightproperty.final doubleGets the value of themaxHeightproperty.final doubleGets the value of themaxWidthproperty.final doubleGets the value of theminHeightproperty.final doubleGets the value of theminWidthproperty.final ColorGets the value of thepageFillproperty.final doubleGets the value of theprefHeightproperty.final doubleGets the value of theprefWidthproperty.final doublegetWidth()Gets the value of thewidthproperty.final doublegetZoom()Gets the value of thezoomproperty.Height of thisWebView.final booleanGets the value of thecontextMenuEnabledproperty.final doublemaxHeight(double width) Called during layout to determine the maximum height for this node.Maximum height property.final doublemaxWidth(double height) Called during layout to determine the maximum width for this node.Maximum width property.final doubleminHeight(double width) Called during layout to determine the minimum height for this node.Minimum height property.final doubleminWidth(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 doubleprefHeight(double width) Called during layout to determine the preferred height for this node.Preferred height property.final doubleprefWidth(double height) Called during layout to determine the preferred width for this node.Preferred width property.final voidsetContextMenuEnabled(boolean value) Sets the value of thecontextMenuEnabledproperty.final voidsetFontScale(double value) Sets the value of thefontScaleproperty.final voidSets the value of thefontSmoothingTypeproperty.final voidsetMaxHeight(double value) Sets the value of themaxHeightproperty.voidsetMaxSize(double maxWidth, double maxHeight) Convenience method for setting maximum width and height.final voidsetMaxWidth(double value) Sets the value of themaxWidthproperty.final voidsetMinHeight(double value) Sets the value of theminHeightproperty.voidsetMinSize(double minWidth, double minHeight) Convenience method for setting minimum width and height.final voidsetMinWidth(double value) Sets the value of theminWidthproperty.final voidsetPageFill(Color value) Sets the value of thepageFillproperty.final voidsetPrefHeight(double value) Sets the value of theprefHeightproperty.voidsetPrefSize(double prefWidth, double prefHeight) Convenience method for setting preferred width and height.final voidsetPrefWidth(double value) Sets the value of theprefWidthproperty.final voidsetZoom(double value) Sets the value of thezoomproperty.Width of thisWebView.final DoublePropertyThe current zoom factor applied to the entire page contents.Methods declared in class javafx.scene.ParentcomputeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBaselineOffset, getChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, needsLayoutProperty, requestLayout, requestParentLayout, setNeedsLayout, updateBoundsMethods declared in class javafx.scene.NodeaccessibleHelpProperty, 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, 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, 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, visiblePropertyMethods declared in class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods declared in interface javafx.css.StyleablegetStyleableNode
- 
Property Details- 
widthWidth of thisWebView.- See Also:
 
- 
heightHeight of thisWebView.- See Also:
 
- 
zoomThe current zoom factor applied to the entire page contents.- Default value:
- 1.0
- Since:
- JavaFX 8.0
- See Also:
 
- 
fontScaleSpecifies scale factor applied to font. This setting affects text content but not images and fixed size elements.- Default value:
- 1.0
- See Also:
 
- 
minWidthMinimum width property.
- 
minHeightMinimum height property.
- 
prefWidthPreferred width property.
- 
prefHeightPreferred height property.
- 
maxWidthMaximum width property.
- 
maxHeightMaximum height property.
- 
fontSmoothingTypeSpecifies 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:
 
- 
pageFillSpecifies the background color of the web page.With this property, the WebViewcontrol'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:
 
- 
contextMenuEnabledSpecifies whether context menu is enabled.- Default value:
- true
- Since:
- JavaFX 2.2
- See Also:
 
 
- 
- 
Constructor Details- 
WebViewpublic WebView()Creates aWebViewobject.
 
- 
- 
Method Details- 
getEngineReturns theWebEngineobject.- Returns:
- the WebEngine
 
- 
getWidthpublic final double getWidth()Gets the value of thewidthproperty.- Property description:
- Width of this WebView.
- Returns:
- the value of the widthproperty
- See Also:
 
- 
widthPropertyWidth of thisWebView.- Returns:
- the width property
- See Also:
 
- 
getHeightpublic final double getHeight()Gets the value of theheightproperty.- Property description:
- Height of this WebView.
- Returns:
- the value of the heightproperty
- See Also:
 
- 
heightPropertyHeight of thisWebView.- Returns:
- the height property
- See Also:
 
- 
setZoompublic final void setZoom(double value) Sets the value of thezoomproperty.- Property description:
- The current zoom factor applied to the entire page contents.
- Default value:
- 1.0
- Parameters:
- value- the value for the- zoomproperty
- Since:
- JavaFX 8.0
- See Also:
 
- 
getZoompublic final double getZoom()Gets the value of thezoomproperty.- Property description:
- The current zoom factor applied to the entire page contents.
- Default value:
- 1.0
- Returns:
- the value of the zoomproperty
- Since:
- JavaFX 8.0
- See Also:
 
- 
zoomPropertyThe current zoom factor applied to the entire page contents.- Default value:
- 1.0
- Returns:
- the zoom property
- Since:
- JavaFX 8.0
- See Also:
 
- 
setFontScalepublic final void setFontScale(double value) Sets the value of thefontScaleproperty.- 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 the- fontScaleproperty
- See Also:
 
- 
getFontScalepublic final double getFontScale()Gets the value of thefontScaleproperty.- 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 fontScaleproperty
- See Also:
 
- 
fontScalePropertySpecifies scale factor applied to font. This setting affects text content but not images and fixed size elements.- Default value:
- 1.0
- Returns:
- the fontScaleproperty
- See Also:
 
- 
minWidthpublic final double minWidth(double height) Called during layout to determine the minimum width for this node.
- 
minHeightpublic final double minHeight(double width) Called during layout to determine the minimum height for this node.
- 
prefWidthpublic final double prefWidth(double height) Called during layout to determine the preferred width for this node.
- 
prefHeightpublic final double prefHeight(double width) Called during layout to determine the preferred height for this node.- Overrides:
- prefHeightin class- Node
- 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:
 
- 
maxWidthpublic final double maxWidth(double height) Called during layout to determine the maximum width for this node.
- 
maxHeightpublic final double maxHeight(double width) Called during layout to determine the maximum height for this node.
- 
minWidthPropertyMinimum width property.- Returns:
- the minWidth property
- See Also:
 
- 
setMinWidthpublic final void setMinWidth(double value) Sets the value of theminWidthproperty.- Property description:
- Minimum width property.
- Parameters:
- value- the value for the- minWidthproperty
- See Also:
 
- 
getMinWidthpublic final double getMinWidth()Gets the value of theminWidthproperty.- Property description:
- Minimum width property.
- Returns:
- the value of the minWidthproperty
- See Also:
 
- 
minHeightPropertyMinimum height property.- Returns:
- the minHeight property
- See Also:
 
- 
setMinHeightpublic final void setMinHeight(double value) Sets the value of theminHeightproperty.- Property description:
- Minimum height property.
- Parameters:
- value- the value for the- minHeightproperty
- See Also:
 
- 
getMinHeightpublic final double getMinHeight()Gets the value of theminHeightproperty.- Property description:
- Minimum height property.
- Returns:
- the value of the minHeightproperty
- See Also:
 
- 
setMinSizepublic void setMinSize(double minWidth, double minHeight) Convenience method for setting minimum width and height.- Parameters:
- minWidth- the minimum width
- minHeight- the minimum height
 
- 
prefWidthPropertyPreferred width property.- Returns:
- the prefWidth property
- See Also:
 
- 
setPrefWidthpublic final void setPrefWidth(double value) Sets the value of theprefWidthproperty.- Property description:
- Preferred width property.
- Parameters:
- value- the value for the- prefWidthproperty
- See Also:
 
- 
getPrefWidthpublic final double getPrefWidth()Gets the value of theprefWidthproperty.- Property description:
- Preferred width property.
- Returns:
- the value of the prefWidthproperty
- See Also:
 
- 
prefHeightPropertyPreferred height property.- Returns:
- the prefHeight property
- See Also:
 
- 
setPrefHeightpublic final void setPrefHeight(double value) Sets the value of theprefHeightproperty.- Property description:
- Preferred height property.
- Parameters:
- value- the value for the- prefHeightproperty
- See Also:
 
- 
getPrefHeightpublic final double getPrefHeight()Gets the value of theprefHeightproperty.- Property description:
- Preferred height property.
- Returns:
- the value of the prefHeightproperty
- See Also:
 
- 
setPrefSizepublic void setPrefSize(double prefWidth, double prefHeight) Convenience method for setting preferred width and height.- Parameters:
- prefWidth- the preferred width
- prefHeight- the preferred height
 
- 
maxWidthPropertyMaximum width property.- Returns:
- the maxWidth property
- See Also:
 
- 
setMaxWidthpublic final void setMaxWidth(double value) Sets the value of themaxWidthproperty.- Property description:
- Maximum width property.
- Parameters:
- value- the value for the- maxWidthproperty
- See Also:
 
- 
getMaxWidthpublic final double getMaxWidth()Gets the value of themaxWidthproperty.- Property description:
- Maximum width property.
- Returns:
- the value of the maxWidthproperty
- See Also:
 
- 
maxHeightPropertyMaximum height property.- Returns:
- the maxHeight property
- See Also:
 
- 
setMaxHeightpublic final void setMaxHeight(double value) Sets the value of themaxHeightproperty.- Property description:
- Maximum height property.
- Parameters:
- value- the value for the- maxHeightproperty
- See Also:
 
- 
getMaxHeightpublic final double getMaxHeight()Gets the value of themaxHeightproperty.- Property description:
- Maximum height property.
- Returns:
- the value of the maxHeightproperty
- See Also:
 
- 
setMaxSizepublic void setMaxSize(double maxWidth, double maxHeight) Convenience method for setting maximum width and height.- Parameters:
- maxWidth- the maximum width
- maxHeight- the maximum height
 
- 
setFontSmoothingTypeSets the value of thefontSmoothingTypeproperty.- 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 the- fontSmoothingTypeproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
getFontSmoothingTypeGets the value of thefontSmoothingTypeproperty.- 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 fontSmoothingTypeproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
fontSmoothingTypePropertySpecifies 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 fontSmoothingTypeproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
setPageFillSets the value of thepageFillproperty.- Property description:
- Specifies the background color of the web page.
 With this property, the WebViewcontrol'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 the- pageFillproperty
- Since:
- 18
- See Also:
 
- 
getPageFillGets the value of thepageFillproperty.- Property description:
- Specifies the background color of the web page.
 With this property, the WebViewcontrol'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 pageFillproperty
- Since:
- 18
- See Also:
 
- 
pageFillPropertySpecifies the background color of the web page.With this property, the WebViewcontrol'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 pageFillproperty
- Since:
- 18
- See Also:
 
- 
setContextMenuEnabledpublic final void setContextMenuEnabled(boolean value) Sets the value of thecontextMenuEnabledproperty.- Property description:
- Specifies whether context menu is enabled.
- Default value:
- true
- Parameters:
- value- the value for the- contextMenuEnabledproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
isContextMenuEnabledpublic final boolean isContextMenuEnabled()Gets the value of thecontextMenuEnabledproperty.- Property description:
- Specifies whether context menu is enabled.
- Default value:
- true
- Returns:
- the value of the contextMenuEnabledproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
contextMenuEnabledPropertySpecifies whether context menu is enabled.- Default value:
- true
- Returns:
- the contextMenuEnabledproperty
- Since:
- JavaFX 2.2
- See Also:
 
- 
getClassCssMetaDataGets theCssMetaDataassociated with this class, which may include theCssMetaDataof its superclasses.- Returns:
- the CssMetaData
- Since:
- JavaFX 8.0
 
- 
getCssMetaDataThis method should delegate toNode.getClassCssMetaData()so that a Node's CssMetaData can be accessed without the need for reflection.- Specified by:
- getCssMetaDatain interface- Styleable
- Overrides:
- getCssMetaDatain class- Node
- Returns:
- The CssMetaData associated with this node, which may include the CssMetaData of its superclasses.
- Since:
- JavaFX 8.0
 
 
-