当前位置: 首页>>代码示例>>Java>>正文


Java ScrollPane.setHvalue方法代码示例

本文整理汇总了Java中javafx.scene.control.ScrollPane.setHvalue方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.setHvalue方法的具体用法?Java ScrollPane.setHvalue怎么用?Java ScrollPane.setHvalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setHvalue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ensureVisible

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private static void ensureVisible(ScrollPane pane, Node node) {
    Bounds viewport = pane.getViewportBounds();
    double contentHeight = pane.getContent().getBoundsInLocal().getHeight();
    double contentWidth = pane.getContent().getBoundsInLocal().getWidth();
    double nodeMinY = node.getBoundsInParent().getMinY();
    double nodeMaxY = node.getBoundsInParent().getMaxY();
    double nodeMinX = node.getBoundsInParent().getMinX();
    double nodeMaxX = node.getBoundsInParent().getMaxX();
    double viewportMinY = (contentHeight - viewport.getHeight()) * pane.getVvalue();
    double viewportMaxY = viewportMinY + viewport.getHeight();
    double viewportMinX = (contentWidth - viewport.getWidth()) * pane.getHvalue();
    double viewportMaxX = viewportMinX + viewport.getWidth();
    if (nodeMinY < viewportMinY) {
        pane.setVvalue(nodeMinY / (contentHeight - viewport.getHeight()));
    } else if (nodeMaxY > viewportMaxY) {
        pane.setVvalue((nodeMaxY - viewport.getHeight()) / (contentHeight - viewport.getHeight()));
    }
    if (nodeMinX < viewportMinX) {
        pane.setHvalue(nodeMinX / (contentWidth - viewport.getWidth()));
    } else if (nodeMaxX > viewportMaxX) {
        pane.setHvalue((nodeMaxX - viewport.getWidth()) / (contentWidth - viewport.getWidth()));
    }

}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:25,代码来源:ImagePanel.java

示例2: ensureVisible

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
protected void ensureVisible(Node target) {
    ScrollPane scrollPane = getParentScrollPane(target);
    if (scrollPane == null) {
        return;
    }
    Node content = scrollPane.getContent();
    Bounds contentBounds = content.localToScene(content.getBoundsInLocal());
    Bounds viewportBounds = scrollPane.getViewportBounds();
    Bounds nodeBounds = target.localToScene(target.getBoundsInLocal());
    if (scrollPane.contains(nodeBounds.getMinX() - contentBounds.getMinX(), nodeBounds.getMinY() - contentBounds.getMinY())) {
        return;
    }
    double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY())
            * ((scrollPane.getVmax() - scrollPane.getVmin()) / (contentBounds.getHeight() - viewportBounds.getHeight()));
    scrollPane.setVvalue(toVScroll);
    double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX())
            * ((scrollPane.getHmax() - scrollPane.getHmin()) / (contentBounds.getWidth() - viewportBounds.getWidth()));
    scrollPane.setHvalue(toHScroll);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:FXEventQueueDevice.java

示例3: scrollTo

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void scrollTo(Node target) {
	ScrollPane scrollPane = getParentScrollPane(target);
	if (scrollPane == null)
		return;
	Node content = scrollPane.getContent();
	Bounds contentBounds = content.localToScene(content.getBoundsInLocal());
	Bounds viewportBounds = scrollPane.getViewportBounds();
	Bounds nodeBounds = target.localToScene(target.getBoundsInLocal());
	double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY())
			* ((scrollPane.getVmax() - scrollPane.getVmin())
					/ (contentBounds.getHeight() - viewportBounds.getHeight()));
	if (toVScroll >= scrollPane.getVmin() && toVScroll < scrollPane.getVmax())
		scrollPane.setVvalue(toVScroll);
	double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX())
			* ((scrollPane.getHmax() - scrollPane.getHmin())
					/ (contentBounds.getWidth() - viewportBounds.getWidth()));
	if (toHScroll >= scrollPane.getHmin() && toHScroll < scrollPane.getHmax())
		scrollPane.setHvalue(toHScroll);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:ScrollPaneSample2.java

示例4: drawCard

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void drawCard(Player player, ScrollPane hand, Button deck) {
    if (player.canDraw()) {
        if (!isIA || (isIA && player == player1))
            TransitionDeck_Hand(player, deck, hand);
        player.drawCard();
        deck1.setDisable(true);
        deck2.setDisable(true);
        hand.setVvalue(hand.getVmax());
        hand.setHvalue(hand.getHmax());
        update();
        if (!player.canPlay()) {
            if (player == player1) {
                TransitionAlert(Player1, energy_player1_bckgrd);
            } else {
                TransitionAlert(Player2, energy_player2_bckgrd);
            }
        }
    } else {
        if (player.equals(player1)) {
            AlertBox.displayDebugging("Error", "You cannot have more than \n      5 cards in your hand", 520, 290);
        } else {
            if (!isIA)
                AlertBox.displayDebugging("Error", "You cannot have more than \n      5 cards in your hand", 520, 290);
        }
    }
}
 
开发者ID:PBZ-InsightR,项目名称:Spellmonger3,代码行数:27,代码来源:ControllerPlay.java

示例5: start

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    AnchorPane ap = new AnchorPane();
    ap.setPrefWidth(1000);
    ap.setPrefHeight(1000);
    ScrollPane s = new ScrollPane(ap);
    s.setHvalue(HVALUE_EXPECTED);
    s.setVvalue(VVALUE_EXPECTED);
    Scene root = new Scene(new VBox(s), 320, 240);

    primaryStage.setScene(root);
    primaryStage.setOnShown((WindowEvent event) -> {
        System.out.println("Scroll values are not expected to be 0.");
        System.out.println("HValue: " + s.getHvalue());
        System.out.println("VValue: " + s.getVvalue());
        VALUE_SAME.set((HVALUE_EXPECTED == s.getHvalue()) && (VVALUE_EXPECTED == s.getVvalue()));
        Platform.runLater(primaryStage::close);
    });
    primaryStage.show();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:SimpleScrollPaneApp.java

示例6: movePane

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
void movePane(MouseEvent event) {
    ScrollPane scrollPane = diagramController.getScrollPane();
    double xScroll =  (initMoveX - event.getSceneX()) / 8000; //8000 is the size of aDrawPane set in view.classDiagramView.fxml
    double yScroll = (initMoveY - event.getSceneY()) / 8000;

    scrollPane.setHvalue(scrollPane.getHvalue() + xScroll);
    scrollPane.setVvalue(scrollPane.getVvalue() + yScroll);

    initMoveX = event.getSceneX();
    initMoveY = event.getSceneY();
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:12,代码来源:GraphController.java

示例7: pass

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void pass(Player current, Player opponent, ScrollPane hand) {
    current.attackCreatures(opponent);
    turnFinished(current);
    boolean choice = true;
    if (current.equals(player2)) choice = false;
    deck1.setDisable(choice);
    pass1.setDisable(choice);
    deck2.setDisable(!choice);
    pass2.setDisable(!choice);
    hand.setVvalue(hand.getVmin());
    hand.setHvalue(hand.getHmin());
}
 
开发者ID:PBZ-InsightR,项目名称:Spellmonger3,代码行数:13,代码来源:ControllerPlay.java

示例8: movePane

import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
void movePane(MouseEvent event)
{
    ScrollPane scrollPane = diagramController.getScrollPane();
    double xScroll =  (initMoveX - event.getSceneX())/8000; //8000 is the size of aDrawPane set in view.classDiagramView.fxml
    double yScroll = (initMoveY - event.getSceneY())/8000;




    scrollPane.setHvalue(scrollPane.getHvalue() + xScroll);
    scrollPane.setVvalue(scrollPane.getVvalue() + yScroll);

    initMoveX = event.getSceneX();
    initMoveY = event.getSceneY();

}
 
开发者ID:Imarcus,项目名称:OctoUML,代码行数:17,代码来源:GraphController.java


注:本文中的javafx.scene.control.ScrollPane.setHvalue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。