本文整理汇总了Java中javafx.scene.control.ScrollBar.setOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollBar.setOrientation方法的具体用法?Java ScrollBar.setOrientation怎么用?Java ScrollBar.setOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollBar
的用法示例。
在下文中一共展示了ScrollBar.setOrientation方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createVScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
protected ScrollBar createVScrollBar()
{
ScrollBar s = new ScrollBar();
s.setOrientation(Orientation.VERTICAL);
s.setManaged(true);
s.setMin(0.0);
s.setMax(1.0);
s.valueProperty().addListener((src,old,val) -> setAbsolutePositionVertical(val.doubleValue()));
s.addEventFilter(ScrollEvent.ANY, (ev) -> ev.consume());
return s;
}
示例2: createHScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
protected ScrollBar createHScrollBar()
{
ScrollBar s = new ScrollBar();
s.setOrientation(Orientation.HORIZONTAL);
s.setManaged(true);
s.setMin(0.0);
s.setMax(1.0);
s.valueProperty().addListener((src,old,val) -> setAbsolutePositionHorizontal(val.doubleValue()));
s.addEventFilter(ScrollEvent.ANY, (ev) -> ev.consume());
return s;
}
示例3: createScroll
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
protected ScrollBar createScroll(double min, double max, boolean vertical) {
ScrollBar scroll = new ScrollBar();
scroll.setOrientation(vertical ? Orientation.VERTICAL : Orientation.HORIZONTAL);
scroll.setMin(min);
scroll.setMax(max);
return scroll;
}
示例4: createTableView
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private Node createTableView() {
VBox.setVgrow(tableView, Priority.ALWAYS);
tableView.setFixedCellSize(ROW_HEIGHT);
tableView.createTable();
tableView.bindScrollsToController();
ScrollBar horizontalScrollBar = new ScrollBar();
horizontalScrollBar.setOrientation(Orientation.HORIZONTAL);
horizontalScrollBar.visibleAmountProperty().bind(tableView.widthProperty());
horizontalScrollBar.valueProperty().bindBidirectional(controller.taskHorizontalScrollValueProperty());
return new VBox(tableView, horizontalScrollBar);
}
示例5: AvailableUsersPane
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
/**
* Constructor for the AvailableUsersPane.
*/
public AvailableUsersPane() {
searchField = new CustomTextField();
searchField.setRight(new SVGIcon(FontAwesomeIcon.SEARCH, Constants.EXTRA_SMALL_ICON, true));
searchField.textProperty().addListener((observable, oldValue, newValue) -> search(newValue));
userPanes = new VBox(Constants.INSETS);
statusIcon = new BorderPane(new SVGIcon(MaterialDesignIcon.ACCOUNT_CIRCLE, Constants.MIDDLE_ICON, true));
final ScrollPane verticalScrollPane = new ScrollPane();
verticalScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
verticalScrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
final ScrollBar scrollBar = new ScrollBar();
scrollBar.setOrientation(Orientation.VERTICAL);
this.hiddenSidesPane = new HiddenSidesPane();
hiddenSidesPane.setContent(verticalScrollPane);
hiddenSidesPane.setRight(scrollBar);
//hiddenSidesPane.setTriggerDistance(Constants.TRIGGER_DISTANCE);
scrollBar.maxProperty().bind(verticalScrollPane.vmaxProperty());
scrollBar.minProperty().bind(verticalScrollPane.vminProperty());
verticalScrollPane.setContent(userPanes);
verticalScrollPane.setFitToWidth(true);
enableSearchField(false);
hoverProperty().addListener((observable, oldValue, newValue) -> {
enableSearchField(newValue);
});
}
示例6: createJFXNode
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
@Override
protected ScrollBar createJFXNode() throws Exception
{
final ScrollBar scrollbar = new ScrollBar();
scrollbar.setOrientation(model_widget.propHorizontal().getValue() ? Orientation.VERTICAL : Orientation.HORIZONTAL);
scrollbar.setFocusTraversable(true);
scrollbar.setOnKeyPressed((final KeyEvent event) ->
{
switch (event.getCode())
{
case DOWN: jfx_node.decrement();
break;
case UP: jfx_node.increment();
break;
case PAGE_UP:
//In theory, this may be unsafe; i.e. if max/min are changed
//after node creation.
jfx_node.adjustValue(max);
break;
case PAGE_DOWN:
jfx_node.adjustValue(min);
break;
default: break;
}
});
if (! toolkit.isEditMode())
{ // Prevent UI value update while actively changing
scrollbar.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> isValueChanging = true);
scrollbar.addEventFilter(MouseEvent.MOUSE_RELEASED, event -> isValueChanging = false);
}
enablementChanged(null, null, null);
limitsChanged(null, null, null);
return scrollbar;
}
示例7: 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);
}
示例8: getSimpleBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
public static Node getSimpleBar(){
ScrollBar sb = new ScrollBar();
sb.setMin(0);
sb.setMax(100);
sb.setValue(20);
sb.setOrientation(Orientation.VERTICAL);
return sb;
}
示例9: getAppScrollBar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
public static Node getAppScrollBar(Scene scene,final TilePane tp){
ScrollBar sc = new ScrollBar();
sc.setLayoutX(scene.getWidth()-sc.getWidth());
sc.setMin(0);
sc.setOrientation(Orientation.VERTICAL);
sc.setPrefHeight(180);
sc.setMax(550);
sc.valueProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue<? extends Number> ov,
Number old_val, Number new_val) {
tp.setLayoutY(-new_val.doubleValue());
}
});
sc.setStyle(
"-fx-base: lemonchiffon;"
+ "-fx-border-color: darkgreen; "
+ "-fx-border-insets: -5; "
+ "-fx-border-radius: 10;"
+ "-fx-border-style: dotted;"
+ "-fx-border-width: 2;"
+ "-fx-background-color: #b6e7c9;"
+ "-fx-background-radius: 10;"
);
return sc;
}
示例10: DayViewScrollPane
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
/**
* Constructs a new scrollpane for the given content node.
*
* @param dayView the content node
*/
public DayViewScrollPane(DayViewBase dayView, ScrollBar scrollBar) {
super();
this.dayView = Objects.requireNonNull(dayView);
this.dayView.setManaged(false);
this.dayView.layoutBoundsProperty().addListener(it -> requestLayout());
scrollBar.setOrientation(Orientation.VERTICAL);
scrollBar.maxProperty().bind(dayView.heightProperty().subtract(heightProperty()));
scrollBar.visibleAmountProperty()
.bind(Bindings.multiply(scrollBar.maxProperty(),
Bindings.divide(heightProperty(), dayView.heightProperty())));
scrollBar.valueProperty().addListener(it -> dayView.setTranslateY(scrollBar.getValue() * -1));
// user clicks on scrollbar arrows -> scroll one hour
scrollBar.unitIncrementProperty().bind(dayView.hourHeightProperty());
// user clicks in backround of scrollbar = block scroll -> scroll half a page
scrollBar.blockIncrementProperty().bind(heightProperty().divide(2));
dayView.translateYProperty().addListener(it -> {
updateVisibleTimeRange();
cachedStartTime = getStartTime();
scrollBar.setValue(-dayView.getTranslateY());
});
getChildren().add(dayView);
heightProperty().addListener(it -> updateVisibleTimeRange());
dayView.sceneProperty().addListener(it -> updateVisibleTimeRange());
dayView.heightProperty().addListener(it -> updateVisibleTimeRange());
dayView.visibleHoursProperty().addListener(it -> updateVisibleTimeRange());
dayView.earlyLateHoursStrategyProperty().addListener(it -> requestLayout());
dayView.hourHeightCompressedProperty().addListener(it -> requestLayout());
dayView.hoursLayoutStrategyProperty().addListener(it -> requestLayout());
dayView.hourHeightProperty().addListener(it -> requestLayout());
updateVisibleTimeRange();
addEventFilter(ScrollEvent.SCROLL, evt -> scrollY(evt.getDeltaY()));
// regular drag, e.g. of an entry view
addEventFilter(MouseEvent.MOUSE_DRAGGED, this::autoscrollIfNeeded);
addEventFilter(MouseEvent.MOUSE_RELEASED, evt -> stopAutoScrollIfNeeded());
// drag and drop from the outside
// TODO: PUT BACK IN addEventFilter(MouseEvent.DRAG_DETECTED, evt -> startDrag(evt));
addEventFilter(DragEvent.DRAG_OVER, this::autoscrollIfNeeded);
addEventFilter(DragEvent.DRAG_EXITED, evt -> stopAutoScrollIfNeeded());
addEventFilter(DragEvent.DRAG_DROPPED, evt -> stopAutoScrollIfNeeded());
addEventFilter(DragEvent.DRAG_DONE, evt -> stopAutoScrollIfNeeded());
Rectangle clip = new Rectangle();
clip.widthProperty().bind(widthProperty());
clip.heightProperty().bind(heightProperty());
setClip(clip);
}
示例11: setupScrollbar
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
private void setupScrollbar(final ScrollBar scroll, final Orientation orientation, final double min, final double max, final double unitIncrement) {
scroll.setOrientation(orientation);
scroll.setMin(min);
scroll.setMax(max);
scroll.setUnitIncrement(unitIncrement);
}
示例12: FXZoomRegion
import javafx.scene.control.ScrollBar; //导入方法依赖的package包/类
/**
* Creates a new instance of {@link FXZoomRegion}.
*
* @param pMinZoomValue the minimum zoom value.
* @param pMaxZoomValue the maximum zoom value.
*/
public FXZoomRegion(double pMinZoomValue, double pMaxZoomValue)
{
super();
clippingContainer = new StackPane();
getChildren().add(clippingContainer);
content = new SimpleObjectProperty<>();
content.addListener(this::onContentChanged);
horizontalScrollBar = new ScrollBar();
horizontalScrollBar.setOrientation(Orientation.HORIZONTAL);
getChildren().add(horizontalScrollBar);
scrollBarVisibility = new SimpleObjectProperty<>(ScrollBarVisibility.ONLY_IF_ZOOMED_IN);
verticalScrollBar = new ScrollBar();
verticalScrollBar.setOrientation(Orientation.VERTICAL);
getChildren().add(verticalScrollBar);
zoomHelper = new FXZoomableHelper(pMinZoomValue, pMaxZoomValue);
zoomHelper.zoomProperty().addListener(this::onZoomChanged);
zoomablePane = new StackPane();
clippingContainer.getChildren().add(zoomablePane);
clip = new Rectangle();
clip.widthProperty().bind(clippingContainer.widthProperty());
clip.heightProperty().bind(clippingContainer.heightProperty());
clippingContainer.setClip(clip);
horizontalScrollBar.valueProperty().bindBidirectional(zoomablePane.translateXProperty());
verticalScrollBar.valueProperty().bindBidirectional(zoomablePane.translateYProperty());
addEventFilter(KeyEvent.KEY_PRESSED, this::onKeyPressed);
addEventFilter(MouseEvent.MOUSE_PRESSED, this::onMousePressed);
addEventFilter(MouseEvent.MOUSE_DRAGGED, this::onMouseDragged);
addEventFilter(ScrollEvent.SCROLL, this::onScroll);
update();
}
示例13: 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");
}