Module javafx.web

Class WebView

  • All Implemented Interfaces:
    Styleable, EventTarget

    public final class WebView
    extends Parent
    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
    • Constructor Detail

      • WebView

        public WebView()
        Creates a WebView object.
    • Method Detail

      • getEngine

        public final WebEngine getEngine()
        Returns the WebEngine object.
        Returns:
        the WebEngine
      • getWidth

        public final double getWidth()
        Gets the value of the property width.
        Property description:
        Width of this WebView.
      • getHeight

        public final double getHeight()
        Gets the value of the property height.
        Property description:
        Height of this WebView.
      • setZoom

        public final void setZoom​(double value)
        Sets the value of the property zoom.
        Property description:
        The current zoom factor applied to the entire page contents.
        Default value:
        1.0
        Since:
        JavaFX 8.0
      • getZoom

        public final double getZoom()
        Gets the value of the property zoom.
        Property description:
        The current zoom factor applied to the entire page contents.
        Default value:
        1.0
        Since:
        JavaFX 8.0
      • zoomProperty

        public final DoubleProperty zoomProperty()
        The current zoom factor applied to the entire page contents.
        Default value:
        1.0
        Since:
        JavaFX 8.0
        See Also:
        getZoom(), setZoom(double)
      • setFontScale

        public final void setFontScale​(double value)
        Sets the value of the property fontScale.
        Property description:
        Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.
        Default value:
        1.0
      • getFontScale

        public final double getFontScale()
        Gets the value of the property fontScale.
        Property description:
        Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.
        Default value:
        1.0
      • fontScaleProperty

        public DoubleProperty fontScaleProperty()
        Specifies scale factor applied to font. This setting affects text content but not images and fixed size elements.
        Default value:
        1.0
        See Also:
        getFontScale(), setFontScale(double)
      • minWidth

        public final double minWidth​(double height)
        Called during layout to determine the minimum width for this node.
        Overrides:
        minWidth in class Node
        Parameters:
        height - the height that should be used if minimum width depends on it
        Returns:
        the minimum width that this node should be resized to during layout
        See Also:
        Node.isResizable(), Node.getContentBias()
      • minHeight

        public final double minHeight​(double width)
        Called during layout to determine the minimum height for this node.
        Overrides:
        minHeight in class Node
        Parameters:
        width - the width that should be used if minimum height depends on it
        Returns:
        the minimum height that this node should be resized to during layout
        See Also:
        Node.isResizable(), Node.getContentBias()
      • prefWidth

        public final double prefWidth​(double height)
        Called during layout to determine the preferred width for this node.
        Overrides:
        prefWidth in class Node
        Parameters:
        height - the height that should be used if preferred width depends on it
        Returns:
        the preferred width that this node should be resized to during layout
        See Also:
        Node.isResizable(), Node.getContentBias(), Node.autosize()
      • prefHeight

        public final double prefHeight​(double width)
        Called during layout to determine the preferred height for this node.
        Overrides:
        prefHeight in 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:
        Node.getContentBias(), Node.autosize()
      • maxWidth

        public final double maxWidth​(double height)
        Called during layout to determine the maximum width for this node.
        Overrides:
        maxWidth in class Node
        Parameters:
        height - the height that should be used if maximum width depends on it
        Returns:
        the maximum width that this node should be resized to during layout
        See Also:
        Node.isResizable(), Node.getContentBias()
      • maxHeight

        public final double maxHeight​(double width)
        Called during layout to determine the maximum height for this node.
        Overrides:
        maxHeight in class Node
        Parameters:
        width - the width that should be used if maximum height depends on it
        Returns:
        the maximum height that this node should be resized to during layout
        See Also:
        Node.isResizable(), Node.getContentBias()
      • setMinWidth

        public final void setMinWidth​(double value)
        Sets the value of the property minWidth.
        Property description:
        Minimum width property.
      • getMinWidth

        public final double getMinWidth()
        Gets the value of the property minWidth.
        Property description:
        Minimum width property.
      • setMinHeight

        public final void setMinHeight​(double value)
        Sets the value of the property minHeight.
        Property description:
        Minimum height property.
      • getMinHeight

        public final double getMinHeight()
        Gets the value of the property minHeight.
        Property description:
        Minimum height property.
      • setMinSize

        public void setMinSize​(double minWidth,
                               double minHeight)
        Convenience method for setting minimum width and height.
        Parameters:
        minWidth - the minimum width
        minHeight - the minimum height
      • setPrefWidth

        public final void setPrefWidth​(double value)
        Sets the value of the property prefWidth.
        Property description:
        Preferred width property.
      • getPrefWidth

        public final double getPrefWidth()
        Gets the value of the property prefWidth.
        Property description:
        Preferred width property.
      • setPrefHeight

        public final void setPrefHeight​(double value)
        Sets the value of the property prefHeight.
        Property description:
        Preferred height property.
      • getPrefHeight

        public final double getPrefHeight()
        Gets the value of the property prefHeight.
        Property description:
        Preferred height property.
      • setPrefSize

        public void setPrefSize​(double prefWidth,
                                double prefHeight)
        Convenience method for setting preferred width and height.
        Parameters:
        prefWidth - the preferred width
        prefHeight - the preferred height
      • setMaxWidth

        public final void setMaxWidth​(double value)
        Sets the value of the property maxWidth.
        Property description:
        Maximum width property.
      • getMaxWidth

        public final double getMaxWidth()
        Gets the value of the property maxWidth.
        Property description:
        Maximum width property.
      • setMaxHeight

        public final void setMaxHeight​(double value)
        Sets the value of the property maxHeight.
        Property description:
        Maximum height property.
      • getMaxHeight

        public final double getMaxHeight()
        Gets the value of the property maxHeight.
        Property description:
        Maximum height property.
      • setMaxSize

        public void setMaxSize​(double maxWidth,
                               double maxHeight)
        Convenience method for setting maximum width and height.
        Parameters:
        maxWidth - the maximum width
        maxHeight - the maximum height
      • setFontSmoothingType

        public final void setFontSmoothingType​(FontSmoothingType value)
        Sets the value of the property fontSmoothingType.
        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
        Since:
        JavaFX 2.2
      • getFontSmoothingType

        public final FontSmoothingType getFontSmoothingType()
        Gets the value of the property fontSmoothingType.
        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
        Since:
        JavaFX 2.2
      • fontSmoothingTypeProperty

        public final ObjectProperty<FontSmoothingType> 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
        Since:
        JavaFX 2.2
        See Also:
        getFontSmoothingType(), setFontSmoothingType(FontSmoothingType)
      • setContextMenuEnabled

        public final void setContextMenuEnabled​(boolean value)
        Sets the value of the property contextMenuEnabled.
        Property description:
        Specifies whether context menu is enabled.
        Default value:
        true
        Since:
        JavaFX 2.2
      • isContextMenuEnabled

        public final boolean isContextMenuEnabled()
        Gets the value of the property contextMenuEnabled.
        Property description:
        Specifies whether context menu is enabled.
        Default value:
        true
        Since:
        JavaFX 2.2
      • getClassCssMetaData

        public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
        Returns:
        The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
        Since:
        JavaFX 8.0