Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: WebView

[47:7] extends: Parent

Wraps JavaFX WebView, a node that renders HTML content using an embedded web browser engine. Use getEngine() to load URLs or HTML strings and to interact with the page. WebView extends Parent and does not inherit Region CSS properties.

CSS Properties -- WebView

Property Values Default Description
-fx-context-menu-enabled true | false true When true, the browser's built-in context menu is enabled.
-fx-font-smoothing-type gray | lcd lcd Anti-aliasing strategy for text in the web page.
-fx-font-scale <number> 1 Scale factor applied to all fonts rendered in the page.
-fx-min-width <size> 0 Minimum width of the web view.
-fx-pref-width <size> 800 Preferred width of the web view.
-fx-max-width <size> (double max) Maximum width of the web view.
-fx-min-height <size> 0 Minimum height of the web view.
-fx-pref-height <size> 600 Preferred height of the web view.
-fx-max-height <size> (double max) Maximum height of the web view.

CSS Properties -- Node

Property Values Default Description
-fx-blend-mode add | blue | color-burn | color-dodge | darken | difference | exclusion | green | hard-light | lighten | multiply | overlay | red | screen | soft-light | src-atop | src-in | src-out | src-over null Blend mode used when compositing this node with nodes beneath it.
-fx-cursor null | crosshair | default | hand | move | e-resize | h-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | v-resize | text | wait | <url> null (inherits) Mouse cursor shape shown when the pointer is over this node. Inherits from parent by default.
-fx-effect <effect> null A visual effect (e.g. DropShadow, InnerShadow) applied to the rendered node.
-fx-focus-traversable true | false false Whether this node participates in focus traversal.
-fx-view-order <number> 0 Adjusts rendering and hit-test order within the parent without changing the scene graph order.
-fx-opacity <number> [0.0 - 1.0] 1 Opacity of the node. 0 is fully transparent, 1 is fully opaque.
-fx-rotate <number> 0 Rotation angle in degrees applied around the node's center point.
-fx-scale-x <number> 1 Scale factor along the X axis about the node's center.
-fx-scale-y <number> 1 Scale factor along the Y axis about the node's center.
-fx-scale-z <number> 1 Scale factor along the Z axis about the node's center.
-fx-translate-x <number> 0 Translation offset along the X axis in pixels.
-fx-translate-y <number> 0 Translation offset along the Y axis in pixels.
-fx-translate-z <number> 0 Translation offset along the Z axis in pixels.
visibility visible | hidden | collapse | inherit visible Controls whether the node is rendered and participates in layout.
-fx-managed true | false true When false, the parent layout does not manage this node's position or size.

Methods

  • WebView ()

    Creates a new WebView with default preferred dimensions (800 x 600).

  • getEngine ()

    Returns the WebEngine for loading and managing content.

    • @r A WebEngine object.
  • setPrefSize (double Width, double Height)

    Sets the preferred size.

    • @p Width is a double with the preferred width.
    • @p Height is a double with the preferred height.
    • @r this object for chaining
  • setZoom (double Zoom)

    Sets the zoom level.

    • @p Zoom is a double with the zoom factor (1.0 = 100%).
    • @r this object for chaining
  • getWidth ()

    Returns the current width of the WebView in pixels.

    • @r A double with the width in pixels.
  • widthProperty ()

    Returns the read-only DoubleProperty backing the width.

    • @r An AJO wrapping javafx.beans.property.ReadOnlyDoubleProperty.
  • getHeight ()

    Returns the current height of the WebView in pixels.

    • @r A double with the height in pixels.
  • heightProperty ()

    Returns the read-only DoubleProperty backing the height.

    • @r An AJO wrapping javafx.beans.property.ReadOnlyDoubleProperty.
  • getZoom ()

    Returns the current zoom factor (1.0 = 100%).

    • @r A double with the zoom factor.
  • zoomProperty ()

    Returns the DoubleProperty backing the zoom factor.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setFontScale (double Scale)

    Sets a scale factor applied to all fonts rendered in the page.

    • @p Scale is a double with the font scale (1.0 = 100%).
    • @r this object for chaining
  • getFontScale ()

    Returns the current font scale factor.

    • @r A double with the font scale.
  • fontScaleProperty ()

    Returns the DoubleProperty backing the font scale.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • minWidthProperty ()

    Returns the DoubleProperty backing the minimum width.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setMinWidth (double Val)

    Sets the minimum width of the WebView in pixels.

    • @p Val is a double with the minimum width.
    • @r this object for chaining
  • getMinWidth ()

    Returns the minimum width of the WebView in pixels.

    • @r A double with the minimum width.
  • minHeightProperty ()

    Returns the DoubleProperty backing the minimum height.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setMinHeight (double Val)

    Sets the minimum height of the WebView in pixels.

    • @p Val is a double with the minimum height.
    • @r this object for chaining
  • getMinHeight ()

    Returns the minimum height of the WebView in pixels.

    • @r A double with the minimum height.
  • setMinSize (double Width, double Height)

    Sets both the minimum width and height in one call.

    • @p Width is a double with the minimum width.
    • @p Height is a double with the minimum height.
    • @r this object for chaining
  • prefWidthProperty ()

    Returns the DoubleProperty backing the preferred width.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setPrefWidth (double Val)

    Sets the preferred width of the WebView in pixels.

    • @p Val is a double with the preferred width.
    • @r this object for chaining
  • getPrefWidth ()

    Returns the preferred width of the WebView in pixels.

    • @r A double with the preferred width.
  • prefHeightProperty ()

    Returns the DoubleProperty backing the preferred height.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setPrefHeight (double Val)

    Sets the preferred height of the WebView in pixels.

    • @p Val is a double with the preferred height.
    • @r this object for chaining
  • getPrefHeight ()

    Returns the preferred height of the WebView in pixels.

    • @r A double with the preferred height.
  • maxWidthProperty ()

    Returns the DoubleProperty backing the maximum width.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setMaxWidth (double Val)

    Sets the maximum width of the WebView in pixels.

    • @p Val is a double with the maximum width.
    • @r this object for chaining
  • getMaxWidth ()

    Returns the maximum width of the WebView in pixels.

    • @r A double with the maximum width.
  • maxHeightProperty ()

    Returns the DoubleProperty backing the maximum height.

    • @r An AJO wrapping javafx.beans.property.DoubleProperty.
  • setMaxHeight (double Val)

    Sets the maximum height of the WebView in pixels.

    • @p Val is a double with the maximum height.
    • @r this object for chaining
  • getMaxHeight ()

    Returns the maximum height of the WebView in pixels.

    • @r A double with the maximum height.
  • setMaxSize (double Width, double Height)

    Sets both the maximum width and height in one call.

    • @p Width is a double with the maximum width.
    • @p Height is a double with the maximum height.
    • @r this object for chaining
  • setFontSmoothingType (string Type)

    Sets the font smoothing type. Pass a FontSmoothingType enum name such as "GRAY" or "LCD".

    • @p Type is a string with the FontSmoothingType enum name.
    • @r this object for chaining
  • getFontSmoothingType ()

    Returns the current font smoothing type as a JavaFX enum AJO.

    • @r An AJO wrapping javafx.scene.text.FontSmoothingType.
  • fontSmoothingTypeProperty ()

    Returns the ObjectProperty backing the font smoothing type.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • setPageFill (object ColorObj)

    Sets the paint used as the page background fill when the page does not specify one.

    • @p ColorObj is a Color AJO to use as the page fill.
    • @r this object for chaining
  • getPageFill ()

    Returns the page fill paint.

    • @r An AJO wrapping javafx.scene.paint.Color (or other Paint), or null.
  • pageFillProperty ()

    Returns the ObjectProperty backing the page fill.

    • @r An AJO wrapping javafx.beans.property.ObjectProperty.
  • setContextMenuEnabled (bool Enabled)

    Enables or disables the built-in right-click context menu.

    • @p Enabled is a bool; true enables the context menu.
    • @r this object for chaining
  • isContextMenuEnabled ()

    Returns whether the built-in context menu is enabled.

    • @r A bool; true when the context menu is enabled.
  • contextMenuEnabledProperty ()

    Returns the BooleanProperty backing the context-menu-enabled flag.

    • @r An AJO wrapping javafx.beans.property.BooleanProperty.