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.), it needs to wrap the scroll node in a Group.
ScrollPane sets focusTraversable to false.
ScrollPane only acts on key presses when it has the focus (isFocused()
returns true) and won't respond to key events that bubble up from a
focused child control.
This example creates a ScrollPane, which contains a Rectangle:
Rectangle rect = new Rectangle(200, 200, Color.RED);
ScrollPane s1 = new ScrollPane();
s1.setPrefSize(120, 120);
s1.setContent(rect);
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ScrollPane.
An enumeration denoting the policy to be used by a scrollable Control in deciding whether to show a scroll bar. |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private ObjectProperty | content
The node used as the content of this ScrollPane. |
| private static final String | DEFAULT_STYLE_CLASS
Initialize the style class to 'scroll-view'. |
| private static final PseudoClass | |
| private static final PseudoClass | |
| 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 | hbarPolicy
Specifies the policy for showing the horizontal scroll bar. |
| private DoubleProperty | |
| private DoubleProperty | |
| 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 final PseudoClass | |
| private DoubleProperty | prefViewportHeight
Specify the preferred height of the ScrollPane Viewport. |
| private DoubleProperty | prefViewportWidth
Specify the preferred width of the ScrollPane Viewport. |
| private ObjectProperty | vbarPolicy
Specifies the policy for showing the vertical scroll bar. |
| private ObjectProperty | viewportBounds
The actual Bounds of the ScrollPane Viewport. |
| private DoubleProperty | |
| private DoubleProperty | |
| private DoubleProperty | vvalue
The current vertical scroll position of the ScrollPane. |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final ObjectProperty | |
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| public final BooleanProperty | |
| public final BooleanProperty | |
| public static List | Returns: theCssMetaDataHides javafx. Gets the |
| public final Node | |
| public List | getControlCssMetaData()
Overrides javafx. Gets the unmodifiable list of the control's CSS-styleable properties. |
| public final ScrollPane. | |
| public final double | |
| public final double | |
| public final double | |
| protected Boolean | getInitialFocusTraversable()
Overrides javafx. Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value. |
| public final double | |
| public final double | |
| public final double | |
| public final double | |
| public final ScrollPane. | |
| public final Bounds | |
| public final double | |
| public final double | |
| public final double | |
| public final ObjectProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final boolean | |
| public final boolean | |
| public final boolean | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final BooleanProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public Object | queryAccessibleAttribute(AccessibleAttribute
the requested attribute attribute, Object... optional list of parameters parameters)Overrides javafx. This method is called by the assistive technology to request the value for an attribute. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final ObjectProperty | |
| public final ObjectProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final DoubleProperty |
| content | back to summary |
|---|---|
| private ObjectProperty<Node> content The node used as the content of this ScrollPane. | |
| DEFAULT_STYLE_CLASS | back to summary |
|---|---|
| private static final String DEFAULT_STYLE_CLASS Initialize the style class to 'scroll-view'. This is the selector class from which CSS can be used to style this control. | |
| FIT_TO_HEIGHT_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass FIT_TO_HEIGHT_PSEUDOCLASS_STATE | |
| FIT_TO_WIDTH_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass FIT_TO_WIDTH_PSEUDOCLASS_STATE | |
| fitToHeight | back to summary |
|---|---|
| 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. If the contained node is not a Resizable, this value is ignored. | |
| fitToWidth | back to summary |
|---|---|
| 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. If the contained node is not a Resizable, this value is ignored. | |
| hbarPolicy | back to summary |
|---|---|
| private ObjectProperty<ScrollPane. Specifies the policy for showing the horizontal scroll bar. | |
| hmax | back to summary |
|---|---|
| private DoubleProperty hmax The maximum allowable | |
| hmin | back to summary |
|---|---|
| private DoubleProperty hmin The minimum allowable | |
| hvalue | back to summary |
|---|---|
| private DoubleProperty hvalue The current horizontal scroll position of the ScrollPane. This value
may be set by the application to scroll the view programmatically.
The ScrollPane will update this value whenever the viewport is
scrolled or panned by the user. This value must always be within
the range of | |
| minViewportHeight | back to summary |
|---|---|
| private DoubleProperty minViewportHeight Specify the minimum height of the ScrollPane Viewport. This is the height that will be available to the content node.
| |
| minViewportWidth | back to summary |
|---|---|
| private DoubleProperty minViewportWidth Specify the minimum width of the ScrollPane Viewport. This is the width that will be available to the content node.
| |
| pannable | back to summary |
|---|---|
| private BooleanProperty pannable Specifies whether the user should be able to pan the viewport by using
the mouse. If mouse events reach the ScrollPane (that is, if mouse
events are not blocked by the contained node or one of its children)
then | |
| PANNABLE_PSEUDOCLASS_STATE | back to summary |
|---|---|
| private static final PseudoClass PANNABLE_PSEUDOCLASS_STATE | |
| prefViewportHeight | back to summary |
|---|---|
| private DoubleProperty prefViewportHeight Specify the preferred height of the ScrollPane Viewport. This is the height that will be available to the content node. The overall height of the ScrollPane is the ViewportHeight + padding | |
| prefViewportWidth | back to summary |
|---|---|
| private DoubleProperty prefViewportWidth Specify the preferred width of the ScrollPane Viewport. This is the width that will be available to the content node. The overall width of the ScrollPane is the ViewportWidth + padding | |
| vbarPolicy | back to summary |
|---|---|
| private ObjectProperty<ScrollPane. Specifies the policy for showing the vertical scroll bar. | |
| viewportBounds | back to summary |
|---|---|
| private ObjectProperty<Bounds> viewportBounds The actual Bounds of the ScrollPane Viewport. This is the Bounds of the content node. | |
| vmax | back to summary |
|---|---|
| private DoubleProperty vmax The maximum allowable | |
| vmin | back to summary |
|---|---|
| private DoubleProperty vmin The minimum allowable | |
| vvalue | back to summary |
|---|---|
| private DoubleProperty vvalue The current vertical scroll position of the ScrollPane. This value
may be set by the application to scroll the view programmatically.
The ScrollPane will update this value whenever the viewport is
scrolled or panned by the user. This value must always be within
the range of | |
| ScrollPane | back to summary |
|---|---|
| public ScrollPane() Creates a new ScrollPane. | |
| ScrollPane | back to summary |
|---|---|
| public ScrollPane(Node content) Creates a new ScrollPane.
| |
| contentProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. Create a new instance of the default skin for this control. This is called to create a skin for the control if
no skin is provided via CSS | |
| fitToHeightProperty | back to summary |
|---|---|
| public final BooleanProperty fitToHeightProperty() | |
| fitToWidthProperty | back to summary |
|---|---|
| public final BooleanProperty fitToWidthProperty() | |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Gets the
| |
| getContent | back to summary |
|---|---|
| public final Node getContent() | |
| getControlCssMetaData | back to summary |
|---|---|
| public List Overrides javafx. Doc from javafx. Gets the unmodifiable list of the control's CSS-styleable properties.
| |
| getHbarPolicy | back to summary |
|---|---|
| public final ScrollPane. | |
| getHmax | back to summary |
|---|---|
| public final double getHmax() | |
| getHmin | back to summary |
|---|---|
| public final double getHmin() | |
| getHvalue | back to summary |
|---|---|
| public final double getHvalue() | |
| getInitialFocusTraversable | back to summary |
|---|---|
| protected Boolean getInitialFocusTraversable() Overrides javafx. Returns the initial focus traversable state of this control, for use by the JavaFX CSS engine to correctly set its initial value. This method is overridden as by default UI controls have focus traversable set to true, but that is not appropriate for this control.
| |
| getMinViewportHeight | back to summary |
|---|---|
| public final double getMinViewportHeight() | |
| getMinViewportWidth | back to summary |
|---|---|
| public final double getMinViewportWidth() | |
| getPrefViewportHeight | back to summary |
|---|---|
| public final double getPrefViewportHeight() | |
| getPrefViewportWidth | back to summary |
|---|---|
| public final double getPrefViewportWidth() | |
| getVbarPolicy | back to summary |
|---|---|
| public final ScrollPane. | |
| getViewportBounds | back to summary |
|---|---|
| public final Bounds getViewportBounds() | |
| getVmax | back to summary |
|---|---|
| public final double getVmax() | |
| getVmin | back to summary |
|---|---|
| public final double getVmin() | |
| getVvalue | back to summary |
|---|---|
| public final double getVvalue() | |
| hbarPolicyProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| hmaxProperty | back to summary |
|---|---|
| public final DoubleProperty hmaxProperty() | |
| hminProperty | back to summary |
|---|---|
| public final DoubleProperty hminProperty() | |
| hvalueProperty | back to summary |
|---|---|
| public final DoubleProperty hvalueProperty() | |
| isFitToHeight | back to summary |
|---|---|
| public final boolean isFitToHeight() | |
| isFitToWidth | back to summary |
|---|---|
| public final boolean isFitToWidth() | |
| isPannable | back to summary |
|---|---|
| public final boolean isPannable() | |
| minViewportHeightProperty | back to summary |
|---|---|
| public final DoubleProperty minViewportHeightProperty() | |
| minViewportWidthProperty | back to summary |
|---|---|
| public final DoubleProperty minViewportWidthProperty() | |
| pannableProperty | back to summary |
|---|---|
| public final BooleanProperty pannableProperty() | |
| prefViewportHeightProperty | back to summary |
|---|---|
| public final DoubleProperty prefViewportHeightProperty() | |
| prefViewportWidthProperty | back to summary |
|---|---|
| public final DoubleProperty prefViewportWidthProperty() | |
| queryAccessibleAttribute | back to summary |
|---|---|
| public Object queryAccessibleAttribute(AccessibleAttribute attribute, Object... parameters) Overrides javafx. Doc from javafx. This method is called by the assistive technology to request the value for an attribute.
This method is commonly overridden by subclasses to implement
attributes that are required for a specific role.
| |
| setContent | back to summary |
|---|---|
| public final void setContent(Node value) | |
| setFitToHeight | back to summary |
|---|---|
| public final void setFitToHeight(boolean value) | |
| setFitToWidth | back to summary |
|---|---|
| public final void setFitToWidth(boolean value) | |
| setHbarPolicy | back to summary |
|---|---|
| public final void setHbarPolicy(ScrollPane. | |
| setHmax | back to summary |
|---|---|
| public final void setHmax(double value) | |
| setHmin | back to summary |
|---|---|
| public final void setHmin(double value) | |
| setHvalue | back to summary |
|---|---|
| public final void setHvalue(double value) | |
| setMinViewportHeight | back to summary |
|---|---|
| public final void setMinViewportHeight(double value) | |
| setMinViewportWidth | back to summary |
|---|---|
| public final void setMinViewportWidth(double value) | |
| setPannable | back to summary |
|---|---|
| public final void setPannable(boolean value) | |
| setPrefViewportHeight | back to summary |
|---|---|
| public final void setPrefViewportHeight(double value) | |
| setPrefViewportWidth | back to summary |
|---|---|
| public final void setPrefViewportWidth(double value) | |
| setVbarPolicy | back to summary |
|---|---|
| public final void setVbarPolicy(ScrollPane. | |
| setViewportBounds | back to summary |
|---|---|
| public final void setViewportBounds(Bounds value) | |
| setVmax | back to summary |
|---|---|
| public final void setVmax(double value) | |
| setVmin | back to summary |
|---|---|
| public final void setVmin(double value) | |
| setVvalue | back to summary |
|---|---|
| public final void setVvalue(double value) | |
| vbarPolicyProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| viewportBoundsProperty | back to summary |
|---|---|
| public final ObjectProperty | |
| vmaxProperty | back to summary |
|---|---|
| public final DoubleProperty vmaxProperty() | |
| vminProperty | back to summary |
|---|---|
| public final DoubleProperty vminProperty() | |
| vvalueProperty | back to summary |
|---|---|
| public final DoubleProperty vvalueProperty() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final ScrollPane. | ALWAYS
Indicates that a scroll bar should always be shown. |
| public static final ScrollPane. | AS_NEEDED
Indicates that a scroll bar should be shown when required. |
| public static final ScrollPane. | NEVER
Indicates that a scroll bar should never be shown. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ScrollPane. | |
| public static ScrollPane. |
| ALWAYS | back to summary |
|---|---|
| public static final ScrollPane. Indicates that a scroll bar should always be shown. | |
| AS_NEEDED | back to summary |
|---|---|
| public static final ScrollPane. Indicates that a scroll bar should be shown when required. | |
| NEVER | back to summary |
|---|---|
| public static final ScrollPane. Indicates that a scroll bar should never be shown. | |
| ScrollBarPolicy | back to summary |
|---|---|
| private ScrollBarPolicy() | |
| valueOf | back to summary |
|---|---|
| public static ScrollPane. | |
| values | back to summary |
|---|---|
| public static ScrollPane. | |
| Modifier and Type | Field and Description |
|---|---|
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final List | |
| private static final CssMetaData |
| Access | Constructor and Description |
|---|---|
| private |
| FIT_TO_HEIGHT | back to summary |
|---|---|
| private static final CssMetaData<ScrollPane, Boolean> FIT_TO_HEIGHT | |
| FIT_TO_WIDTH | back to summary |
|---|---|
| private static final CssMetaData<ScrollPane, Boolean> FIT_TO_WIDTH | |
| HBAR_POLICY | back to summary |
|---|---|
| private static final CssMetaData<ScrollPane, ScrollPane. | |
| PANNABLE | back to summary |
|---|---|
| private static final CssMetaData<ScrollPane, Boolean> PANNABLE | |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| VBAR_POLICY | back to summary |
|---|---|
| private static final CssMetaData<ScrollPane, ScrollPane. | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |