@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| 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.
|
private static class |
ScrollPane.StyleableProperties |
| Modifier and Type | Field and Description |
|---|---|
private ObjectProperty<Node> |
content
The node used as the content of this ScrollPane.
|
private static java.lang.String |
DEFAULT_STYLE_CLASS
Initialize the style class to 'scroll-view'.
|
private static PseudoClass |
FIT_TO_HEIGHT_PSEUDOCLASS_STATE |
private static PseudoClass |
FIT_TO_WIDTH_PSEUDOCLASS_STATE |
private 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.
|
private 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.
|
private ObjectProperty<ScrollPane.ScrollBarPolicy> |
hbarPolicy
Specifies the policy for showing the horizontal scroll bar.
|
private DoubleProperty |
hmax
The maximum allowable
hvalue for this ScrollPane. |
private DoubleProperty |
hmin
The minimum allowable
hvalue for this ScrollPane. |
private DoubleProperty |
hvalue
The current horizontal scroll position of the ScrollPane.
|
private DoubleProperty |
minViewportHeight
Specify the minimum height of the ScrollPane Viewport.
|
private DoubleProperty |
minViewportWidth
Specify the minimum width of the ScrollPane Viewport.
|
private BooleanProperty |
pannable
Specifies whether the user should be able to pan the viewport by using
the mouse.
|
private static PseudoClass |
PANNABLE_PSEUDOCLASS_STATE |
private DoubleProperty |
prefViewportHeight
Specify the preferred height of the ScrollPane Viewport.
|
private DoubleProperty |
prefViewportWidth
Specify the perferred width of the ScrollPane Viewport.
|
private ObjectProperty<ScrollPane.ScrollBarPolicy> |
vbarPolicy
Specifies the policy for showing the vertical scroll bar.
|
private ObjectProperty<Bounds> |
viewportBounds
The actual Bounds of the ScrollPane Viewport.
|
private DoubleProperty |
vmax
The maximum allowable
vvalue for this ScrollPane. |
private DoubleProperty |
vmin
The minimum allowable
vvalue for this ScrollPane. |
private DoubleProperty |
vvalue
The current vertical scroll position of the ScrollPane.
|
USE_COMPUTED_SIZE, USE_PREF_SIZEBASELINE_OFFSET_SAME_AS_HEIGHT| Constructor and Description |
|---|
ScrollPane()
Creates a new ScrollPane.
|
ScrollPane(Node content)
Creates a new ScrollPane.
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getSkin, getTooltip, impl_processCSS, isResizable, layoutChildren, loadSkinClass, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipPropertybackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getUserAgentStylesheet, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthPropertygetChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBoundsaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, 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, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, 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, visiblePropertyprivate ObjectProperty<ScrollPane.ScrollBarPolicy> hbarPolicy
private ObjectProperty<ScrollPane.ScrollBarPolicy> vbarPolicy
private ObjectProperty<Node> content
private DoubleProperty hvalue
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.private DoubleProperty vvalue
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.private DoubleProperty hmin
hvalue for this ScrollPane.
Default value is 0.private DoubleProperty vmin
vvalue for this ScrollPane.
Default value is 0.private DoubleProperty hmax
hvalue for this ScrollPane.
Default value is 1.private DoubleProperty vmax
vvalue for this ScrollPane.
Default value is 1.private BooleanProperty fitToWidth
private BooleanProperty fitToHeight
private BooleanProperty pannable
pannable is consulted to determine if the events should be
used for panning.private DoubleProperty prefViewportWidth
private DoubleProperty prefViewportHeight
private DoubleProperty minViewportWidth
prefViewportWidthProperty()private DoubleProperty minViewportHeight
prefViewportHeightProperty()private ObjectProperty<Bounds> viewportBounds
private static final java.lang.String DEFAULT_STYLE_CLASS
private static final PseudoClass PANNABLE_PSEUDOCLASS_STATE
private static final PseudoClass FIT_TO_WIDTH_PSEUDOCLASS_STATE
private static final PseudoClass FIT_TO_HEIGHT_PSEUDOCLASS_STATE
public ScrollPane()
public ScrollPane(Node content)
content - the initial content for the ScrollPanepublic 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()
public final void setHvalue(double value)
public final double getHvalue()
public final DoubleProperty hvalueProperty()
public final void setVvalue(double value)
public final double getVvalue()
public final DoubleProperty vvalueProperty()
public final void setHmin(double value)
public final double getHmin()
public final DoubleProperty hminProperty()
public final void setVmin(double value)
public final double getVmin()
public final DoubleProperty vminProperty()
public final void setHmax(double value)
public final double getHmax()
public final DoubleProperty hmaxProperty()
public final void setVmax(double value)
public final double getVmax()
public final DoubleProperty vmaxProperty()
public final void setFitToWidth(boolean value)
public final boolean isFitToWidth()
public final BooleanProperty fitToWidthProperty()
public final void setFitToHeight(boolean value)
public final boolean isFitToHeight()
public final BooleanProperty fitToHeightProperty()
public final void setPannable(boolean value)
public final boolean isPannable()
public final BooleanProperty pannableProperty()
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 setMinViewportWidth(double value)
public final double getMinViewportWidth()
public final DoubleProperty minViewportWidthProperty()
public final void setMinViewportHeight(double value)
public final double getMinViewportHeight()
public final DoubleProperty minViewportHeightProperty()
public final void setViewportBounds(Bounds value)
public final Bounds getViewportBounds()
public final ObjectProperty<Bounds> viewportBoundsProperty()
protected Skin<?> createDefaultSkin()
-fx-skin or set explicitly in a sub-class with setSkin(...).createDefaultSkin in class Controlpublic static java.util.List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
public java.util.List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
getControlCssMetaData in class Control@Deprecated protected java.lang.Boolean impl_cssGetFocusTraversableInitialValue()
impl_cssGetFocusTraversableInitialValue in class Controlpublic java.lang.Object queryAccessibleAttribute(AccessibleAttribute attribute, java.lang.Object... parameters)
queryAccessibleAttribute in class Controlattribute - the requested attributeparameters - optional list of parametersAccessibleAttribute