public final class WebView
extends Parent
WebView
is a javafx.scene.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.
|
<any> |
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
The current zoom factor applied to the entire page contents.
|
Modifier and Type | Class and Description |
---|---|
private static class |
WebView.StyleableProperties
Super-lazy instantiation pattern from Bill Pugh.
|
Modifier and Type | Field and Description |
---|---|
private BooleanProperty |
contextMenuEnabled
Specifies whether context menu is enabled.
|
private static boolean |
DEFAULT_CONTEXT_MENU_ENABLED |
private static double |
DEFAULT_FONT_SCALE |
private static FontSmoothingType |
DEFAULT_FONT_SMOOTHING_TYPE |
private static double |
DEFAULT_MAX_HEIGHT |
private static double |
DEFAULT_MAX_WIDTH |
private static double |
DEFAULT_MIN_HEIGHT |
private static double |
DEFAULT_MIN_WIDTH |
private static double |
DEFAULT_PREF_HEIGHT |
private static double |
DEFAULT_PREF_WIDTH |
private static double |
DEFAULT_ZOOM |
private WebEngine |
engine |
private DoubleProperty |
fontScale
Specifies scale factor applied to font.
|
private <any> |
fontSmoothingType
Specifies a requested font smoothing type : gray or LCD.
|
private ReadOnlyDoubleWrapper |
height |
private static java.util.Map<java.lang.Object,java.lang.Integer> |
idMap |
private InputMethodClientImpl |
imClient |
private DoubleProperty |
maxHeight |
private DoubleProperty |
maxWidth |
private DoubleProperty |
minHeight |
private DoubleProperty |
minWidth |
private WebPage |
page |
private DoubleProperty |
prefHeight |
private DoubleProperty |
prefWidth |
private TKPulseListener |
stagePulseListener
The stage pulse listener registered with the toolkit.
|
private ReadOnlyDoubleWrapper |
width |
private static int |
WK_DND_ACTION_COPY |
private static int |
WK_DND_ACTION_LINK |
private static int |
WK_DND_ACTION_MOVE |
private static int |
WK_DND_ACTION_NONE |
private DoubleProperty |
zoom |
Constructor and Description |
---|
WebView()
Creates a
WebView object. |
Modifier and Type | Method and Description |
---|---|
BooleanProperty |
contextMenuEnabledProperty()
Specifies whether context menu is enabled.
|
private boolean |
doComputeContains(double localX,
double localY) |
private BaseBounds |
doComputeGeomBounds(BaseBounds bounds,
BaseTransform tx) |
private NGNode |
doCreatePeer() |
private void |
doPickNodeLocal(PickRay pickRay,
PickResultChooser result) |
private void |
doTransformsChanged() |
private void |
doUpdatePeer() |
DoubleProperty |
fontScaleProperty()
Specifies scale factor applied to font.
|
<any> |
fontSmoothingTypeProperty()
Specifies a requested font smoothing type : gray or LCD.
|
protected <any> |
getChildren() |
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getCssMetaData() |
WebEngine |
getEngine()
Returns the
WebEngine object. |
double |
getFontScale()
Gets the value of the property fontScale.
|
FontSmoothingType |
getFontSmoothingType()
Gets the value of the property fontSmoothingType.
|
private static TransferMode[] |
getFXDndAction(int wkDndAction) |
double |
getHeight()
Gets the value of the property height.
|
private InputMethodClientImpl |
getInputMethodClient() |
double |
getMaxHeight()
Gets the value of the property maxHeight.
|
double |
getMaxWidth()
Gets the value of the property maxWidth.
|
double |
getMinHeight()
Gets the value of the property minHeight.
|
double |
getMinWidth()
Gets the value of the property minWidth.
|
double |
getPrefHeight()
Gets the value of the property prefHeight.
|
double |
getPrefWidth()
Gets the value of the property prefWidth.
|
double |
getWidth()
Gets the value of the property width.
|
private static int |
getWKDndAction(TransferMode... tms) |
private static int |
getWKDndEventType(EventType et) |
double |
getZoom()
Gets the value of the property zoom.
|
private void |
handleStagePulse() |
ReadOnlyDoubleProperty |
heightProperty()
Height of this
WebView . |
boolean |
isContextMenuEnabled()
Gets the value of the property contextMenuEnabled.
|
boolean |
isResizable() |
private boolean |
isTreeReallyVisible() |
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.
|
private void |
processInputMethodEvent(InputMethodEvent ie) |
private void |
processKeyEvent(KeyEvent ev) |
private void |
processMouseEvent(MouseEvent ev) |
private void |
processScrollEvent(ScrollEvent ev) |
private void |
registerEventHandlers() |
void |
resize(double width,
double 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 the value of the property maxHeight.
|
void |
setMaxSize(double maxWidth,
double maxHeight)
Convenience method for setting maximum width and height.
|
void |
setMaxWidth(double value)
Sets the value of the property maxWidth.
|
void |
setMinHeight(double value)
Sets the value of the property minHeight.
|
void |
setMinSize(double minWidth,
double minHeight)
Convenience method for setting minimum width and height.
|
void |
setMinWidth(double value)
Sets the value of the property minWidth.
|
void |
setPrefHeight(double value)
Sets the value of the property prefHeight.
|
void |
setPrefSize(double prefWidth,
double prefHeight)
Convenience method for setting preferred width and height.
|
void |
setPrefWidth(double value)
Sets the value of the property prefWidth.
|
void |
setZoom(double value)
Sets the value of the property zoom.
|
ReadOnlyDoubleProperty |
widthProperty()
Width of this
WebView . |
DoubleProperty |
zoomProperty()
The current zoom factor applied to the entire page contents.
|
public ReadOnlyDoubleProperty widthProperty
WebView
.getWidth()
public ReadOnlyDoubleProperty heightProperty
WebView
.getHeight()
public final DoubleProperty zoomProperty
getZoom()
,
setZoom(double)
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 <any> fontSmoothingTypeProperty
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
public final BooleanProperty contextMenuEnabledProperty
isContextMenuEnabled()
,
setContextMenuEnabled(boolean)
private static final java.util.Map<java.lang.Object,java.lang.Integer> idMap
private static final boolean DEFAULT_CONTEXT_MENU_ENABLED
private static final FontSmoothingType DEFAULT_FONT_SMOOTHING_TYPE
private static final double DEFAULT_ZOOM
private static final double DEFAULT_FONT_SCALE
private static final double DEFAULT_MIN_WIDTH
private static final double DEFAULT_MIN_HEIGHT
private static final double DEFAULT_PREF_WIDTH
private static final double DEFAULT_PREF_HEIGHT
private static final double DEFAULT_MAX_WIDTH
private static final double DEFAULT_MAX_HEIGHT
private final WebPage page
private final WebEngine engine
private volatile InputMethodClientImpl imClient
private final TKPulseListener stagePulseListener
private final ReadOnlyDoubleWrapper width
private final ReadOnlyDoubleWrapper height
private DoubleProperty zoom
private DoubleProperty fontScale
private DoubleProperty minWidth
private DoubleProperty minHeight
private DoubleProperty prefWidth
private DoubleProperty prefHeight
private DoubleProperty maxWidth
private DoubleProperty maxHeight
private <any> fontSmoothingType
private BooleanProperty contextMenuEnabled
private static final int WK_DND_ACTION_NONE
private static final int WK_DND_ACTION_COPY
private static final int WK_DND_ACTION_MOVE
private static final int WK_DND_ACTION_LINK
public final WebEngine getEngine()
WebEngine
object.public final double getWidth()
public ReadOnlyDoubleProperty widthProperty()
WebView
.getWidth()
public final double getHeight()
public ReadOnlyDoubleProperty heightProperty()
WebView
.getHeight()
public final void setZoom(double value)
public final double getZoom()
public final DoubleProperty zoomProperty()
getZoom()
,
setZoom(double)
public final void setFontScale(double value)
public final double getFontScale()
public DoubleProperty fontScaleProperty()
getFontScale()
,
setFontScale(double)
public boolean isResizable()
public void resize(double width, double height)
public final double minWidth(double height)
public final double minHeight(double width)
public final double prefWidth(double height)
public final double prefHeight(double width)
public final double maxWidth(double height)
public final double maxHeight(double width)
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)
minWidth
- the minimum widthminHeight
- the minimum heightpublic 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)
prefWidth
- the preferred widthprefHeight
- the preferred heightpublic 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)
maxWidth
- the maximum widthmaxHeight
- the maximum heightpublic final void setFontSmoothingType(FontSmoothingType value)
public final FontSmoothingType getFontSmoothingType()
public final <any> fontSmoothingTypeProperty()
getFontSmoothingType()
,
setFontSmoothingType(FontSmoothingType)
public final void setContextMenuEnabled(boolean value)
public final boolean isContextMenuEnabled()
public final BooleanProperty contextMenuEnabledProperty()
isContextMenuEnabled()
,
setContextMenuEnabled(boolean)
public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getCssMetaData()
private boolean isTreeReallyVisible()
private void handleStagePulse()
private void processMouseEvent(MouseEvent ev)
private void processScrollEvent(ScrollEvent ev)
private void processKeyEvent(KeyEvent ev)
private InputMethodClientImpl getInputMethodClient()
private void processInputMethodEvent(InputMethodEvent ie)
private static int getWKDndEventType(EventType et)
private static int getWKDndAction(TransferMode... tms)
private static TransferMode[] getFXDndAction(int wkDndAction)
private void registerEventHandlers()
private void doPickNodeLocal(PickRay pickRay, PickResultChooser result)
protected <any> getChildren()
private NGNode doCreatePeer()
private BaseBounds doComputeGeomBounds(BaseBounds bounds, BaseTransform tx)
private void doTransformsChanged()
private boolean doComputeContains(double localX, double localY)
private void doUpdatePeer()