當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollPane.setVvalue方法代碼示例

本文整理匯總了Java中javafx.scene.control.ScrollPane.setVvalue方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.setVvalue方法的具體用法?Java ScrollPane.setVvalue怎麽用?Java ScrollPane.setVvalue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setVvalue方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: centerNodeInScrollPane

import javafx.scene.control.ScrollPane; //導入方法依賴的package包/類
public void centerNodeInScrollPane(ScrollPane scrollPane, Node node) {
    double h = scrollPane.getContent().getBoundsInLocal().getHeight();
    double y = (node.getBoundsInParent().getMaxY() + 
                node.getBoundsInParent().getMinY()) / 2.0;
    double v = scrollPane.getViewportBounds().getHeight();
    scrollPane.setVvalue(scrollPane.getVmax() * ((y - 0.5 * v) / (h - v)));
}
 
開發者ID:rcbyron,項目名稱:java-projects,代碼行數:8,代碼來源:CritterWorldController.java

示例9: 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.setVvalue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。