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


Java Node.getTranslateY方法代碼示例

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


在下文中一共展示了Node.getTranslateY方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: scaleAll

import javafx.scene.Node; //導入方法依賴的package包/類
private static void scaleAll(Scene scene, Node node) {
    double translateX = node.getTranslateX();
    double translateY = node.getTranslateY();
    double baseX = node.getBoundsInParent().getMinX();
    double baseY = node.getBoundsInParent().getMinY();
    double sceneWidth = scene.getWidth();
    double sceneHeight = scene.getHeight();
    ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> {
        node.setScaleX(newValue.doubleValue() / sceneWidth);
        node.setTranslateX(translateX + (baseX * newValue.doubleValue() / sceneWidth) - baseX);
    };

    scene.widthProperty().addListener(widthResizer);
    ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> {
        node.setScaleY(newValue.doubleValue() / sceneHeight);
        node.setTranslateY(translateY + (baseY * newValue.doubleValue() / sceneHeight) - baseY);
    };
    scene.heightProperty().addListener(heightResizer);

}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:21,代碼來源:BaseController.java

示例2: handle

import javafx.scene.Node; //導入方法依賴的package包/類
@Override
public void handle(MouseEvent event) {

    // don't do anything if the user is in the process of adding to the selection model
    if( event.isControlDown() || event.isShiftDown()) {
        return;
    }

    Node node = (Node) event.getSource();

    dragContext.x = node.getTranslateX() - event.getSceneX();
    dragContext.y = node.getTranslateY() - event.getSceneY();

    // clear the model if the current node isn't in the selection => new selection
    if( !selectionModel.contains(node)) {
        selectionModel.clear();
        selectionModel.add( node);
    }

    // flag that the mouse released handler should consume the event, so it won't bubble up to the pane which has a rubberband selection mouse released handler
    enabled = true;

    // prevent rubberband selection handler
    event.consume();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:26,代碼來源:ExampleMouseDrag2.java

示例3: toggleYsettingsObject

import javafx.scene.Node; //導入方法依賴的package包/類
/**
 * Moves the FXML object up or down as much as the height of the listview to
 * edit the labels, because the listview needs to push down the objects
 * below it.
 *
 * @param id
 *         The fx:id of the object to be moved.
 */
private void toggleYsettingsObject(String id) {
    Node node = slidingPane.lookup("#" + id);
    if (node.getTranslateY() == 0) {
        node.setTranslateY(editLabelsPane.getHeight());
    } else {
        node.setTranslateY(0);
    }
}
 
開發者ID:deltadak,項目名稱:plep,代碼行數:17,代碼來源:SlidingSettingsPane.java

示例4: handle

import javafx.scene.Node; //導入方法依賴的package包/類
public void handle(MouseEvent event) {

            // left mouse button => dragging
            if (!event.isPrimaryButtonDown())
                return;

            nodeDragContext.mouseAnchorX = event.getSceneX();
            nodeDragContext.mouseAnchorY = event.getSceneY();

            Node node = (Node) event.getSource();
            System.out.format("%10f,%10f%n", node.getTranslateX(), node.getTranslateY());

            nodeDragContext.translateAnchorX = node.getTranslateX();
            nodeDragContext.translateAnchorY = node.getTranslateY();

        }
 
開發者ID:INAETICS,項目名稱:Drones-Simulator,代碼行數:17,代碼來源:NodeGestures.java

示例5: fixPosition

import javafx.scene.Node; //導入方法依賴的package包/類
/**
 * Set node's layout position to current position, remove translate coordinates.
 * @param node
 */
private void fixPosition( Node node) {

    double x = node.getTranslateX();
    double y = node.getTranslateY();

    node.relocate(node.getLayoutX() + x, node.getLayoutY() + y);

    node.setTranslateX(0);
    node.setTranslateY(0);

}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:16,代碼來源:ExampleMouseDrag2.java


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