下面列出了javafx.scene.control.ScrollPane.ScrollBarPolicy#NEVER 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private boolean determineHorizontalSBVisible() {
final ScrollPane sp = getSkinnable();
if (IS_TOUCH_SUPPORTED) {
return (tempVisibility && (nodeWidth > contentWidth));
} else {
// RT-17395: ScrollBarPolicy might be null. If so, treat it as
// "AS_NEEDED", which is the default
ScrollBarPolicy hbarPolicy = sp.getHbarPolicy();
return (ScrollBarPolicy.NEVER == hbarPolicy) ? false
: ((ScrollBarPolicy.ALWAYS == hbarPolicy) ? true : ((sp.isFitToWidth() && scrollNode != null ? scrollNode.isResizable() : false) ? (nodeWidth > contentWidth && scrollNode.minWidth(-1) > contentWidth) : (nodeWidth > contentWidth)));
}
}
private boolean determineVerticalSBVisible() {
final ScrollPane sp = getSkinnable();
if (IS_TOUCH_SUPPORTED) {
return (tempVisibility && (nodeHeight > contentHeight));
} else {
// RT-17395: ScrollBarPolicy might be null. If so, treat it as
// "AS_NEEDED", which is the default
ScrollBarPolicy vbarPolicy = sp.getVbarPolicy();
return (ScrollBarPolicy.NEVER == vbarPolicy) ? false
: ((ScrollBarPolicy.ALWAYS == vbarPolicy) ? true : ((sp.isFitToHeight() && scrollNode != null ? scrollNode.isResizable() : false) ? (nodeHeight > contentHeight && scrollNode.minHeight(-1) > contentHeight) : (nodeHeight > contentHeight)));
}
}
/**
* A JavaFxTopComponent will have a ScrollPane by default, as it cannot know
* the expected layout of the given pane. If you wish to remove the
* horizontal scroll bar, you can override this method to return
* ScrollBarPolicy.NEVER.
*
* @return a {@link ScrollBarPolicy} representing the desired horizontal
* scroll bar policy.
*/
protected ScrollBarPolicy getHorizontalScrollPolicy() {
return ScrollBarPolicy.NEVER;
}
/**
* A JavaFxTopComponent will have a ScrollPane by default, as it cannot know
* the expected layout of the given pane. If you wish to remove the vertical
* scroll bar, you can override this method to return ScrollBarPolicy.NEVER.
*
* @return a {@link ScrollBarPolicy} representing the desired vertical
* scroll bar policy.
*/
protected ScrollBarPolicy getVerticalScrollPolicy() {
return ScrollBarPolicy.NEVER;
}