本文整理汇总了Java中javafx.scene.control.ScrollBar.setVisibleAmount方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.setVisibleAmount方法的具体用法?Java ScrollBar.setVisibleAmount怎么用?Java ScrollBar.setVisibleAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.setVisibleAmount方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTextAreaHeight
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Deprecated
private void setTextAreaHeight() {
// elements
Region content = (Region) messageText.lookup(".content");
ScrollBar scrollBarv = (ScrollBar) messageText.lookup(".scroll-bar:vertical");
// get the height of content
double height = MINIMUM_HEIGHT;
if (messageText.getText().length() > 10) {
Insets padding = messageText.getPadding();
height = content.getHeight() + padding.getTop() + padding.getBottom();
}
// set height
height = Math.max(MINIMUM_HEIGHT, height);
height = Math.min(MAXIMUM_HEIGHT, height);
messageText.setMinHeight(height);
messageText.setPrefHeight(height);
// enable or the scroll bar
scrollBarv.setVisibleAmount(MAXIMUM_HEIGHT);
}
示例2: horizontalScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private ScrollBar horizontalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setMinSize(minw, minh);
scrollBar.setPrefSize(prefw, prefh);
scrollBar.setMaxSize(maxw, maxh);
scrollBar.setVisibleAmount(50);
scrollBar.setMax(xBarWidth-(2*circleRadius));
return scrollBar;
}
示例3: verticalScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private ScrollBar verticalScrollBar(double minw, double minh, double prefw, double prefh, double maxw, double maxh) {
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setMinSize(minw, minh);
scrollBar.setPrefSize(prefw, prefh);
scrollBar.setMaxSize(maxw, maxh);
scrollBar.setVisibleAmount(50);
scrollBar.setMax(yBarHeight-(2*circleRadius));
return scrollBar;
}
示例4: drawNode
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override
public Node drawNode() {
ScrollBar scroll = createScroll(0, 100, vertical);
scroll.setVisibleAmount(amount);
if (Double.compare(scroll.getVisibleAmount(), amount) != 0) {
reportGetterFailure("Slider.getVisibleAmount()");
}
return scroll;
}
示例5: ServiceScroller
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
public ServiceScroller() {
setMaxWidth(Mephisto3.WIDTH);
sc = new ScrollBar();
sc.setOrientation(Orientation.HORIZONTAL);
//this will hide the already invisible scroll buttons
sc.setPadding(new Insets(0, -20, 0, -20));
sc.setId("scroller");
sc.setMin(0);
sc.setVisibleAmount(0.9);
setCenter(sc);
}
示例6: setScrollBarRange
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void setScrollBarRange( ScrollBar scrollBar, double screenSize, double objectSize ) {
double range = Math.max( 0, objectSize - screenSize );
scrollBar.setValue( Math.min( scrollBar.getValue(), range ) );
scrollBar.setMax( range );
scrollBar.setBlockIncrement( range/100 );
scrollBar.setVisibleAmount( range * (screenSize/objectSize) );
}
示例7: setupStatesPane
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private Pane setupStatesPane() {
final Label titleLabel = new Label("All execution states (0)");
nbStates.addListener((v, o, n) -> {
String s = "All execution states (" + n.intValue() + ")";
Platform.runLater(() -> {
titleLabel.setText(s);
titleLabel.setContentDisplay(ContentDisplay.RIGHT);
final ImageView nodeGraphic = new ImageView();
nodeGraphic.setImage(playGraphic);
titleLabel.setGraphic(nodeGraphic);
isInReplayMode.addListener((val, old, neu) -> {
if (old != neu) {
if (neu) {
nodeGraphic.setImage(replayGraphic);
} else {
nodeGraphic.setImage(playGraphic);
}
}
});
});
});
titleLabel.setFont(statesFont);
VBox.setMargin(titleLabel, HALF_MARGIN_INSETS);
titleLabel.setAlignment(Pos.CENTER);
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setVisibleAmount(1);
scrollBar.setBlockIncrement(10);
scrollBar.setMin(0);
final IntegerBinding statesRange = visibleStatesRange.subtract(1);
scrollBar.disableProperty().bind(statesRange.lessThanOrEqualTo(0));
scrollBar.maxProperty().bind(statesRange);
scrollBar.valueProperty().addListener((v, o, n) -> {
if (o.intValue() != n.intValue() && n.intValue() != currentState.intValue()) {
currentState.set(n.intValue());
}
});
currentState.addListener((v, o, n) -> {
if (o.intValue() != n.intValue() && n.intValue() != scrollBar.valueProperty().intValue()) {
scrollBar.setValue(n.intValue());
}
});
final HBox hBox = new HBox();
final Polygon arrow = new Polygon(2.5, 10, 10, 5, 2.5, 0);
HBox.setMargin(arrow, HALF_MARGIN_INSETS);
final Label toggleValuesLabel = new Label("Timeline for dynamic information ");
toggleValuesLabel.setFont(statesFont);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(arrow, toggleValuesLabel);
hBox.setCursor(Cursor.HAND);
hBox.setOnMouseClicked((e) -> {
if (bodyScrollPane.isVisible()) {
bodyScrollPane.setVisible(false);
arrow.setRotate(0);
} else {
bodyScrollPane.setVisible(true);
arrow.setRotate(90);
}
});
VBox.setMargin(hBox, HALF_MARGIN_INSETS);
headerPane.getChildren().addAll(scrollBar, titleLabel, statesPane, hBox);
VBox.setMargin(statesPane, MARGIN_INSETS);
return headerPane;
}
示例8: ContextMenu
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
/**
* Constructor for the ContextMenu.
*
* @param height Height
* @param width Width
*/
public ContextMenu(final double height, final double width) {
this.setMinHeight(height);
this.setMinWidth(width);
this.setPrefHeight(height);
this.setPrefWidth(width);
fullscreenBtn = new FloatingButton(new SVGIcon(MaterialIcon.FULLSCREEN, Constants.MIDDLE_ICON, true));
settingsBtn = new FloatingButton(new SVGIcon(MaterialDesignIcon.SETTINGS, Constants.MIDDLE_ICON, true));
HBox floatingButtons = new HBox(20.0, settingsBtn, fullscreenBtn);
floatingButtons.setAlignment(Pos.TOP_LEFT);
floatingButtons.translateYProperty().set(Constants.FLOATING_BUTTON_OFFSET_Y);
floatingButtons.translateXProperty().set(Constants.FLOATING_BUTTON_OFFSET_X);
roomInfo = new Label("Select a Room");
roomInfo.setAlignment(Pos.TOP_CENTER);
roomInfo.getStyleClass().clear();
roomInfo.getStyleClass().add("headline");
verticalScrollPane = new ScrollPane();
verticalScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
verticalScrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setOrientation(Orientation.VERTICAL);
final HiddenSidesPane hiddenSidesPane = new HiddenSidesPane();
hiddenSidesPane.setContent(verticalScrollPane);
hiddenSidesPane.setRight(scrollBar);
hiddenSidesPane.setTriggerDistance(Constants.TRIGGER_DISTANCE);
hiddenSidesPane.getStyleClass().add("hidden-sides-pane");
scrollBar.maxProperty().bind(verticalScrollPane.vmaxProperty());
scrollBar.minProperty().bind(verticalScrollPane.vminProperty());
verticalScrollPane.vvalueProperty().bindBidirectional(scrollBar.valueProperty());
//TODO: Delete completely - at the moment it is just not added to the rest
contextSortingPane = new ContextSortingPane(width + Constants.INSETS);
contextSortingPane.setMaxWidth(Double.MAX_VALUE);
titledPaneContainer = new TitledUnitPaneContainer();
verticalScrollPane.setFitToWidth(true);
verticalScrollPane.setContent(titledPaneContainer);
//TODO: Find a nicer way to scale the size of the scroll bar thumb
scrollBar.setVisibleAmount(0.25);
this.getChildren().addAll(floatingButtons, roomInfo, hiddenSidesPane);
//VBox.setVgrow(contextSortingPane, Priority.ALWAYS);
this.getStyleClass().addAll("detail-menu");
}