@DefaultProperty(value="content") public class ScrollPane extends Control
The ScrollPane allows the application to set the current, minimum, and
maximum values for positioning the contents in the horizontal and
vertical directions. These values are mapped proportionally onto the
layoutBounds of the contained node.
ScrollPane layout calculations are based on the layoutBounds rather than the boundsInParent (visual bounds) of the scroll node. If an application wants the scrolling to be based on the visual bounds of the node (for scaled content etc.), they need to wrap the scroll node in a Group.
ScrollPane sets focusTraversable to false.
This example creates a ScrollPane, which contains a Rectangle :
import javafx.scene.control.ScrollPane;
import javafx.scene.shape.Rectangle;
Rectangle rect = new Rectangle(200, 200, Color.RED);
ScrollPane s1 = new ScrollPane();
s1.setPrefSize(120, 120);
s1.setContent(rect);
Implementation of ScrollPane According to JavaFX UI Control API Specification| Type | Property and Description |
|---|---|
ObjectProperty<Node> |
content
The node used as the content of this ScrollPane.
|
BooleanProperty |
fitToHeight
If true and if the contained node is a Resizable, then the node will be
kept resized to match the height of the ScrollPane's viewport.
|
BooleanProperty |
fitToWidth
If true and if the contained node is a Resizable, then the node will be
kept resized to match the width of the ScrollPane's viewport.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
hbarPolicy
Specifies the policy for showing the horizontal scroll bar.
|
DoubleProperty |
hmax
The maximum allowable
hvalue for this ScrollPane. |
DoubleProperty |
hmin
The minimum allowable
hvalue for this ScrollPane. |
DoubleProperty |
hvalue
The current horizontal scroll position of the ScrollPane.
|
BooleanProperty |
pannable
Specifies whether the user should be able to pan the viewport by using
the mouse.
|
DoubleProperty |
prefViewportHeight
Specify the preferred height of the ScrollPane Viewport.
|
DoubleProperty |
prefViewportWidth
Specify the perferred width of the ScrollPane Viewport.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
vbarPolicy
Specifies the policy for showing the vertical scroll bar.
|
ObjectProperty<Bounds> |
viewportBounds
The actual Bounds of the ScrollPane Viewport.
|
DoubleProperty |
vmax
The maximum allowable
vvalue for this ScrollPane. |
DoubleProperty |
vmin
The minimum allowable
vvalue for this ScrollPane. |
DoubleProperty |
vvalue
The current vertical scroll position of the ScrollPane.
|
contextMenu, height, maxHeight, maxWidth, minHeight, minWidth, prefHeight, prefWidth, skinClassName, skin, tooltip, widthneedsLayoutblendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effect, eventDispatcher, focused, focusTraversable, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, 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| Modifier and Type | Class and Description |
|---|---|
static class |
ScrollPane.ScrollBarPolicy
An enumeration denoting the policy to be used by a scrollable
Control in deciding whether to show a scroll bar.
|
USE_COMPUTED_SIZE, USE_PREF_SIZE| Constructor and Description |
|---|
ScrollPane()
Creates a new ScrollPane.
|
| Modifier and Type | Method and Description |
|---|---|
ObjectProperty<Node> |
contentProperty()
The node used as the content of this ScrollPane.
|
BooleanProperty |
fitToHeightProperty()
If true and if the contained node is a Resizable, then the node will be
kept resized to match the height of the ScrollPane's viewport.
|
BooleanProperty |
fitToWidthProperty()
If true and if the contained node is a Resizable, then the node will be
kept resized to match the width of the ScrollPane's viewport.
|
Node |
getContent()
Gets the value of the property content.
|
ScrollPane.ScrollBarPolicy |
getHbarPolicy()
Gets the value of the property hbarPolicy.
|
double |
getHmax()
Gets the value of the property hmax.
|
double |
getHmin()
Gets the value of the property hmin.
|
double |
getHvalue()
Gets the value of the property hvalue.
|
double |
getPrefViewportHeight()
Gets the value of the property prefViewportHeight.
|
double |
getPrefViewportWidth()
Gets the value of the property prefViewportWidth.
|
ScrollPane.ScrollBarPolicy |
getVbarPolicy()
Gets the value of the property vbarPolicy.
|
Bounds |
getViewportBounds()
Gets the value of the property viewportBounds.
|
double |
getVmax()
Gets the value of the property vmax.
|
double |
getVmin()
Gets the value of the property vmin.
|
double |
getVvalue()
Gets the value of the property vvalue.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
hbarPolicyProperty()
Specifies the policy for showing the horizontal scroll bar.
|
DoubleProperty |
hmaxProperty()
The maximum allowable
hvalue for this ScrollPane. |
DoubleProperty |
hminProperty()
The minimum allowable
hvalue for this ScrollPane. |
DoubleProperty |
hvalueProperty()
The current horizontal scroll position of the ScrollPane.
|
boolean |
isFitToHeight()
Gets the value of the property fitToHeight.
|
boolean |
isFitToWidth()
Gets the value of the property fitToWidth.
|
boolean |
isPannable()
Gets the value of the property pannable.
|
BooleanProperty |
pannableProperty()
Specifies whether the user should be able to pan the viewport by using
the mouse.
|
DoubleProperty |
prefViewportHeightProperty()
Specify the preferred height of the ScrollPane Viewport.
|
DoubleProperty |
prefViewportWidthProperty()
Specify the perferred width of the ScrollPane Viewport.
|
void |
setContent(Node value)
Sets the value of the property content.
|
void |
setFitToHeight(boolean value)
Sets the value of the property fitToHeight.
|
void |
setFitToWidth(boolean value)
Sets the value of the property fitToWidth.
|
void |
setHbarPolicy(ScrollPane.ScrollBarPolicy value)
Sets the value of the property hbarPolicy.
|
void |
setHmax(double value)
Sets the value of the property hmax.
|
void |
setHmin(double value)
Sets the value of the property hmin.
|
void |
setHvalue(double value)
Sets the value of the property hvalue.
|
void |
setPannable(boolean value)
Sets the value of the property pannable.
|
void |
setPrefViewportHeight(double value)
Sets the value of the property prefViewportHeight.
|
void |
setPrefViewportWidth(double value)
Sets the value of the property prefViewportWidth.
|
void |
setVbarPolicy(ScrollPane.ScrollBarPolicy value)
Sets the value of the property vbarPolicy.
|
void |
setViewportBounds(Bounds value)
Sets the value of the property viewportBounds.
|
void |
setVmax(double value)
Sets the value of the property vmax.
|
void |
setVmin(double value)
Sets the value of the property vmin.
|
void |
setVvalue(double value)
Sets the value of the property vvalue.
|
ObjectProperty<ScrollPane.ScrollBarPolicy> |
vbarPolicyProperty()
Specifies the policy for showing the vertical scroll bar.
|
ObjectProperty<Bounds> |
viewportBoundsProperty()
The actual Bounds of the ScrollPane Viewport.
|
DoubleProperty |
vmaxProperty()
The maximum allowable
vvalue for this ScrollPane. |
DoubleProperty |
vminProperty()
The minimum allowable
vvalue for this ScrollPane. |
DoubleProperty |
vvalueProperty()
The current vertical scroll position of the ScrollPane.
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getHeight, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getSkin, getTooltip, getUserAgentStylesheet, getWidth, heightProperty, intersects, isResizable, layoutChildren, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, setContextMenu, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setPrefHeight, setPrefSize, setPrefWidth, setSkin, setSkinClassName, setTooltip, setWidth, skinClassNameProperty, skinProperty, tooltipProperty, widthPropertygetChildren, getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, setNeedsLayoutaddEventFilter, addEventHandler, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, 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, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getUserData, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToSceneTransformProperty, lookupAll, managedProperty, mouseTransparentProperty, 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, pickOnBoundsProperty, pressedProperty, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, 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, visiblePropertypublic final ObjectProperty<ScrollPane.ScrollBarPolicy> hbarPolicyProperty
public final ObjectProperty<ScrollPane.ScrollBarPolicy> vbarPolicyProperty
public final ObjectProperty<Node> contentProperty
getContent(),
setContent(Node)public final DoubleProperty hvalueProperty
hmin to hmax. When hvalue
equals hmin, the contained node is positioned so that
its layoutBounds minX is visible. When hvalue
equals hmax, the contained node is positioned so that its
layoutBounds maxX is visible. When hvalue is between
hmin and hmax, the contained node is positioned
proportionally between layoutBounds minX and
layoutBounds maxX.getHvalue(),
setHvalue(double)public final DoubleProperty vvalueProperty
vmin to vmax. When vvalue
equals vmin, the contained node is positioned so that
its layoutBounds minY is visible. When vvalue
equals vmax, the contained node is positioned so that its
layoutBounds maxY is visible. When vvalue is between
vmin and vmax, the contained node is positioned
proportionally between layoutBounds minY and
layoutBounds maxY.getVvalue(),
setVvalue(double)public final DoubleProperty hminProperty
hvalue for this ScrollPane.getHmin(),
setHmin(double)public final DoubleProperty vminProperty
vvalue for this ScrollPane.getVmin(),
setVmin(double)public final DoubleProperty hmaxProperty
hvalue for this ScrollPane.getHmax(),
setHmax(double)public final DoubleProperty vmaxProperty
vvalue for this ScrollPane.getVmax(),
setVmax(double)public final BooleanProperty fitToWidthProperty
isFitToWidth(),
setFitToWidth(boolean)public final BooleanProperty fitToHeightProperty
isFitToHeight(),
setFitToHeight(boolean)public final BooleanProperty pannableProperty
pannable is consulted to determine if the events should be
used for panning.isPannable(),
setPannable(boolean)public final DoubleProperty prefViewportWidthProperty
public final DoubleProperty prefViewportHeightProperty
public final ObjectProperty<Bounds> viewportBoundsProperty
getViewportBounds(),
setViewportBounds(Bounds)public final void setHbarPolicy(ScrollPane.ScrollBarPolicy value)
public final ScrollPane.ScrollBarPolicy getHbarPolicy()
public final ObjectProperty<ScrollPane.ScrollBarPolicy> hbarPolicyProperty()
public final void setVbarPolicy(ScrollPane.ScrollBarPolicy value)
public final ScrollPane.ScrollBarPolicy getVbarPolicy()
public final ObjectProperty<ScrollPane.ScrollBarPolicy> vbarPolicyProperty()
public final void setContent(Node value)
public final Node getContent()
public final ObjectProperty<Node> contentProperty()
getContent(),
setContent(Node)public final void setHvalue(double value)
hmin to hmax. When hvalue
equals hmin, the contained node is positioned so that
its layoutBounds minX is visible. When hvalue
equals hmax, the contained node is positioned so that its
layoutBounds maxX is visible. When hvalue is between
hmin and hmax, the contained node is positioned
proportionally between layoutBounds minX and
layoutBounds maxX.public final double getHvalue()
hmin to hmax. When hvalue
equals hmin, the contained node is positioned so that
its layoutBounds minX is visible. When hvalue
equals hmax, the contained node is positioned so that its
layoutBounds maxX is visible. When hvalue is between
hmin and hmax, the contained node is positioned
proportionally between layoutBounds minX and
layoutBounds maxX.public final DoubleProperty hvalueProperty()
hmin to hmax. When hvalue
equals hmin, the contained node is positioned so that
its layoutBounds minX is visible. When hvalue
equals hmax, the contained node is positioned so that its
layoutBounds maxX is visible. When hvalue is between
hmin and hmax, the contained node is positioned
proportionally between layoutBounds minX and
layoutBounds maxX.getHvalue(),
setHvalue(double)public final void setVvalue(double value)
vmin to vmax. When vvalue
equals vmin, the contained node is positioned so that
its layoutBounds minY is visible. When vvalue
equals vmax, the contained node is positioned so that its
layoutBounds maxY is visible. When vvalue is between
vmin and vmax, the contained node is positioned
proportionally between layoutBounds minY and
layoutBounds maxY.public final double getVvalue()
vmin to vmax. When vvalue
equals vmin, the contained node is positioned so that
its layoutBounds minY is visible. When vvalue
equals vmax, the contained node is positioned so that its
layoutBounds maxY is visible. When vvalue is between
vmin and vmax, the contained node is positioned
proportionally between layoutBounds minY and
layoutBounds maxY.public final DoubleProperty vvalueProperty()
vmin to vmax. When vvalue
equals vmin, the contained node is positioned so that
its layoutBounds minY is visible. When vvalue
equals vmax, the contained node is positioned so that its
layoutBounds maxY is visible. When vvalue is between
vmin and vmax, the contained node is positioned
proportionally between layoutBounds minY and
layoutBounds maxY.getVvalue(),
setVvalue(double)public final void setHmin(double value)
hvalue for this ScrollPane.public final double getHmin()
hvalue for this ScrollPane.public final DoubleProperty hminProperty()
hvalue for this ScrollPane.getHmin(),
setHmin(double)public final void setVmin(double value)
vvalue for this ScrollPane.public final double getVmin()
vvalue for this ScrollPane.public final DoubleProperty vminProperty()
vvalue for this ScrollPane.getVmin(),
setVmin(double)public final void setHmax(double value)
hvalue for this ScrollPane.public final double getHmax()
hvalue for this ScrollPane.public final DoubleProperty hmaxProperty()
hvalue for this ScrollPane.getHmax(),
setHmax(double)public final void setVmax(double value)
vvalue for this ScrollPane.public final double getVmax()
vvalue for this ScrollPane.public final DoubleProperty vmaxProperty()
vvalue for this ScrollPane.getVmax(),
setVmax(double)public final void setFitToWidth(boolean value)
public final boolean isFitToWidth()
public final BooleanProperty fitToWidthProperty()
isFitToWidth(),
setFitToWidth(boolean)public final void setFitToHeight(boolean value)
public final boolean isFitToHeight()
public final BooleanProperty fitToHeightProperty()
isFitToHeight(),
setFitToHeight(boolean)public final void setPannable(boolean value)
pannable is consulted to determine if the events should be
used for panning.public final boolean isPannable()
pannable is consulted to determine if the events should be
used for panning.public final BooleanProperty pannableProperty()
pannable is consulted to determine if the events should be
used for panning.isPannable(),
setPannable(boolean)public final void setPrefViewportWidth(double value)
public final double getPrefViewportWidth()
public final DoubleProperty prefViewportWidthProperty()
public final void setPrefViewportHeight(double value)
public final double getPrefViewportHeight()
public final DoubleProperty prefViewportHeightProperty()
public final void setViewportBounds(Bounds value)
public final Bounds getViewportBounds()
public final ObjectProperty<Bounds> viewportBoundsProperty()
getViewportBounds(),
setViewportBounds(Bounds)Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.