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.
Type | Property and Description |
---|---|
BooleanProperty |
contextMenuEnabled
Specifies whether context menu is enabled.
|
DoubleProperty |
fontScale
Specifies scale factor applied to font.
|
ObjectProperty<FontSmoothingType> |
fontSmoothingType
Specifies a requested font smoothing type : gray or LCD.
|
ReadOnlyDoubleProperty |
height
Height of this
WebView . |
DoubleProperty |
maxHeight
Maximum height property.
|
DoubleProperty |
maxWidth
Maximum width property.
|
DoubleProperty |
minHeight
Minimum height property.
|
DoubleProperty |
minWidth
Minimum width property.
|
DoubleProperty |
prefHeight
Preferred height property.
|
DoubleProperty |
prefWidth
Preferred width property.
|
ReadOnlyDoubleProperty |
width
Width of this
WebView . |
DoubleProperty |
zoom
Returns zoom property object.
|
needsLayout
accessibleHelp, 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, visible
BASELINE_OFFSET_SAME_AS_HEIGHT
Constructor and Description |
---|
WebView()
Creates a
WebView object. |
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
contextMenuEnabledProperty()
Specifies whether context menu is enabled.
|
DoubleProperty |
fontScaleProperty()
Specifies scale factor applied to font.
|
ObjectProperty<FontSmoothingType> |
fontSmoothingTypeProperty()
Specifies a requested font smoothing type : gray or LCD.
|
protected ObservableList<Node> |
getChildren()
Gets the list of children of this
Parent . |
static List<CssMetaData<? extends Styleable,?>> |
getClassCssMetaData() |
List<CssMetaData<? extends Styleable,?>> |
getCssMetaData()
This method should delegate to
Node.getClassCssMetaData() so that
a Node's CssMetaData can be accessed without the need for reflection. |
WebEngine |
getEngine()
Returns the
WebEngine object. |
double |
getFontScale()
Gets the value of the property fontScale.
|
FontSmoothingType |
getFontSmoothingType()
Gets the value of the property fontSmoothingType.
|
double |
getHeight()
Returns height of this
WebView . |
double |
getMaxHeight()
Returns maximum height.
|
double |
getMaxWidth()
Returns maximum width.
|
double |
getMinHeight()
Sets minimum height.
|
double |
getMinWidth()
Returns minimum width.
|
double |
getPrefHeight()
Returns preferred height.
|
double |
getPrefWidth()
Returns preferred width.
|
double |
getWidth()
Returns width of this
WebView . |
double |
getZoom()
Returns current zoom factor applied to the whole page contents.
|
ReadOnlyDoubleProperty |
heightProperty()
Height of this
WebView . |
boolean |
isContextMenuEnabled()
Gets the value of the property contextMenuEnabled.
|
boolean |
isResizable()
Indicates whether this node is a type which can be resized by its parent.
|
double |
maxHeight(double width)
Called during layout to determine the maximum height for this node.
|
DoubleProperty |
maxHeightProperty()
Maximum height property.
|
double |
maxWidth(double height)
Called during layout to determine the maximum width for this node.
|
DoubleProperty |
maxWidthProperty()
Maximum width property.
|
double |
minHeight(double width)
Called during layout to determine the minimum height for this node.
|
DoubleProperty |
minHeightProperty()
Minimum height property.
|
double |
minWidth(double height)
Called during layout to determine the minimum width for this node.
|
DoubleProperty |
minWidthProperty()
Minimum width property.
|
double |
prefHeight(double width)
Called during layout to determine the preferred height for this node.
|
DoubleProperty |
prefHeightProperty()
Preferred height property.
|
double |
prefWidth(double height)
Called during layout to determine the preferred width for this node.
|
DoubleProperty |
prefWidthProperty()
Preferred width property.
|
void |
resize(double width,
double height)
If the node is resizable, will set its layout bounds to the specified
width and height.
|
void |
setContextMenuEnabled(boolean value)
Sets the value of the property contextMenuEnabled.
|
void |
setFontScale(double value)
Sets the value of the property fontScale.
|
void |
setFontSmoothingType(FontSmoothingType value)
Sets the value of the property fontSmoothingType.
|
void |
setMaxHeight(double value)
Sets maximum height.
|
void |
setMaxSize(double maxWidth,
double maxHeight)
Convenience method for setting maximum width and height.
|
void |
setMaxWidth(double value)
Sets maximum width.
|
void |
setMinHeight(double value)
Sets minimum height.
|
void |
setMinSize(double minWidth,
double minHeight)
Convenience method for setting minimum width and height.
|
void |
setMinWidth(double value)
Sets minimum width.
|
void |
setPrefHeight(double value)
Sets preferred height.
|
void |
setPrefSize(double prefWidth,
double prefHeight)
Convenience method for setting preferred width and height.
|
void |
setPrefWidth(double value)
Sets preferred width.
|
void |
setZoom(double value)
Sets current zoom factor applied to the whole page contents.
|
ReadOnlyDoubleProperty |
widthProperty()
Width of this
WebView . |
DoubleProperty |
zoomProperty()
Returns zoom property object.
|
computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBaselineOffset, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, layoutChildren, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setNeedsLayout, updateBounds
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, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, 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, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, 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, 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, relocate, removeEventFilter, removeEventHandler, requestFocus, 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, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public ReadOnlyDoubleProperty widthProperty
WebView
.getWidth()
public ReadOnlyDoubleProperty heightProperty
WebView
.getHeight()
public final DoubleProperty zoomProperty
getZoom()
,
setZoom(double value)
public DoubleProperty fontScaleProperty
getFontScale()
,
setFontScale(double)
public DoubleProperty minWidthProperty
getMinWidth()
,
setMinWidth(double)
public DoubleProperty minHeightProperty
getMinHeight()
,
setMinHeight(double)
public DoubleProperty prefWidthProperty
getPrefWidth()
,
setPrefWidth(double)
public DoubleProperty prefHeightProperty
getPrefHeight()
,
setPrefHeight(double)
public DoubleProperty maxWidthProperty
getMaxWidth()
,
setMaxWidth(double)
public DoubleProperty maxHeightProperty
getMaxHeight()
,
setMaxHeight(double)
public final ObjectProperty<FontSmoothingType> fontSmoothingTypeProperty
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
public final BooleanProperty contextMenuEnabledProperty
isContextMenuEnabled()
,
setContextMenuEnabled(boolean)
public final WebEngine getEngine()
WebEngine
object.public final double getWidth()
WebView
.public ReadOnlyDoubleProperty widthProperty()
WebView
.getWidth()
public final double getHeight()
WebView
.public ReadOnlyDoubleProperty heightProperty()
WebView
.getHeight()
public final void setZoom(double value)
value
- zoom factor to be setzoomProperty()
,
getZoom()
public final double getZoom()
zoomProperty()
,
setZoom(double value)
public final DoubleProperty zoomProperty()
getZoom()
,
setZoom(double value)
public final void setFontScale(double value)
public final double getFontScale()
public DoubleProperty fontScaleProperty()
getFontScale()
,
setFontScale(double)
public boolean isResizable()
Node
If this method returns false, then the parent cannot resize it during layout (resize() is a no-op) and it should return its layoutBounds for minimum, preferred, and maximum sizes. Group, Text, and all Shapes are not resizable and hence depend on the application to establish their sizing by setting appropriate properties (e.g. width/height for Rectangle, text on Text, and so on). Non-resizable nodes may still be relocated during layout.
isResizable
in class Node
Node.getContentBias()
,
Node.minWidth(double)
,
Node.minHeight(double)
,
Node.prefWidth(double)
,
Node.prefHeight(double)
,
Node.maxWidth(double)
,
Node.maxHeight(double)
,
Node.resize(double, double)
,
Node.getLayoutBounds()
public void resize(double width, double height)
Node
This method should generally only be called by parent nodes from their layoutChildren() methods. All Parent classes will automatically resize resizable children, so resizing done directly by the application will be overridden by the node's parent, unless the child is unmanaged.
Parents are responsible for ensuring the width and height values fall within the resizable node's preferred range. The autosize() method may be used if the parent just needs to resize the node to its preferred size.
resize
in class Node
width
- the target layout bounds widthheight
- the target layout bounds heightNode.isResizable()
,
Node.getContentBias()
,
Node.autosize()
,
Node.minWidth(double)
,
Node.minHeight(double)
,
Node.prefWidth(double)
,
Node.prefHeight(double)
,
Node.maxWidth(double)
,
Node.maxHeight(double)
,
Node.getLayoutBounds()
public final double minWidth(double height)
minWidth
in class Parent
height
- the height that should be used if minimum width depends on itNode.isResizable()
,
Node.getContentBias()
public final double minHeight(double width)
minHeight
in class Parent
width
- the width that should be used if minimum height depends on itNode.isResizable()
,
Node.getContentBias()
public final double prefWidth(double height)
prefWidth
in class Parent
height
- the height that should be used if preferred width depends on itNode.isResizable()
,
Node.getContentBias()
,
Node.autosize()
public final double prefHeight(double width)
prefHeight
in class Parent
width
- the width that should be used if preferred height depends on itNode.getContentBias()
,
Node.autosize()
public final double maxWidth(double height)
maxWidth
in class Node
height
- the height that should be used if maximum width depends on itNode.isResizable()
,
Node.getContentBias()
public final double maxHeight(double width)
maxHeight
in class Node
width
- the width that should be used if maximum height depends on itNode.isResizable()
,
Node.getContentBias()
public DoubleProperty minWidthProperty()
getMinWidth()
,
setMinWidth(double)
public final void setMinWidth(double value)
public final double getMinWidth()
public DoubleProperty minHeightProperty()
getMinHeight()
,
setMinHeight(double)
public final void setMinHeight(double value)
public final double getMinHeight()
public void setMinSize(double minWidth, double minHeight)
public DoubleProperty prefWidthProperty()
getPrefWidth()
,
setPrefWidth(double)
public final void setPrefWidth(double value)
public final double getPrefWidth()
public DoubleProperty prefHeightProperty()
getPrefHeight()
,
setPrefHeight(double)
public final void setPrefHeight(double value)
public final double getPrefHeight()
public void setPrefSize(double prefWidth, double prefHeight)
public DoubleProperty maxWidthProperty()
getMaxWidth()
,
setMaxWidth(double)
public final void setMaxWidth(double value)
public final double getMaxWidth()
public DoubleProperty maxHeightProperty()
getMaxHeight()
,
setMaxHeight(double)
public final void setMaxHeight(double value)
public final double getMaxHeight()
public void setMaxSize(double maxWidth, double maxHeight)
public final void setFontSmoothingType(FontSmoothingType value)
public final FontSmoothingType getFontSmoothingType()
public final ObjectProperty<FontSmoothingType> fontSmoothingTypeProperty()
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
public final void setContextMenuEnabled(boolean value)
public final boolean isContextMenuEnabled()
public final BooleanProperty contextMenuEnabledProperty()
isContextMenuEnabled()
,
setContextMenuEnabled(boolean)
public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public List<CssMetaData<? extends Styleable,?>> getCssMetaData()
Node.getClassCssMetaData()
so that
a Node's CssMetaData can be accessed without the need for reflection.getCssMetaData
in interface Styleable
getCssMetaData
in class Node
protected ObservableList<Node> getChildren()
Parent
Parent
.
See the class documentation for Node
for scene graph structure
restrictions on setting a Parent
's children list.
If these restrictions are violated by a change to the list of children,
the change is ignored and the previous value of the children list is
restored. An IllegalArgumentException
is thrown in this case.
If this Parent
node is attached to a Scene
attached to a Window
that is showning (Window.isShowing()
), then its
list of children must only be modified on the JavaFX Application Thread.
An IllegalStateException
is thrown if this restriction is
violated.
Note to subclasses: if you override this method, you must return from your implementation the result of calling this super method. The actual list instance returned from any getChildren() implementation must be the list owned and managed by this Parent. The only typical purpose for overriding this method is to promote the method to be public.
getChildren
in class Parent
Parent
.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.