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


Java Node.setTranslateY方法代码示例

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


在下文中一共展示了Node.setTranslateY方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: zoomInAndCenter

import javafx.scene.Node; //导入方法依赖的package包/类
private static void zoomInAndCenter(Node node, double initialWidth, double initialHeight, boolean preserveRatio) {
    Parent parent = node.getParent();

    node.toFront();

    Bounds parentBoundsInParent = parent.getBoundsInLocal();

    double xScaleRatio = parentBoundsInParent.getMaxX() / initialWidth;
    double yScaleRatio = parentBoundsInParent.getMaxY() / initialHeight;

    if (preserveRatio) {
        double bestScaleRatio = Math.min(xScaleRatio, yScaleRatio);
        node.setScaleX(bestScaleRatio);
        node.setScaleY(bestScaleRatio);
    } else {
        node.setScaleX(xScaleRatio);
        node.setScaleY(yScaleRatio);
    }

    Bounds boundsInParent = node.getBoundsInParent();

    double translateX = -1 * Math.abs(boundsInParent.getMinY());
    double translateY = -1 * Math.abs(boundsInParent.getMinY());

    node.setTranslateX(translateX);
    node.setTranslateY(translateY);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:28,代码来源:StatsDisplay.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包/类
@Override
public void handle(MouseEvent event) {

    if( !enabled) {
        return;
    }

    // all in selection
    for( Node node: selectionModel.selection) {
        node.setTranslateX( dragContext.x + event.getSceneX());
        node.setTranslateY( dragContext.y + event.getSceneY());
    }

}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:15,代码来源:ExampleMouseDrag2.java

示例5: zoomOutAndReset

import javafx.scene.Node; //导入方法依赖的package包/类
private static void zoomOutAndReset(Node node) {
    node.setScaleX(1);
    node.setScaleY(1);
    node.setTranslateX(0);
    node.setTranslateY(0);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:7,代码来源:StatsDisplay.java

示例6: handle

import javafx.scene.Node; //导入方法依赖的package包/类
public void handle(MouseEvent event) {

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

            double scale = canvas.getScale();

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

            node.setTranslateX(nodeDragContext.translateAnchorX + ((event.getSceneX() - nodeDragContext.mouseAnchorX) / scale));
            node.setTranslateY(nodeDragContext.translateAnchorY + ((event.getSceneY() - nodeDragContext.mouseAnchorY) / scale));

            event.consume();

        }
 
开发者ID:INAETICS,项目名称:Drones-Simulator,代码行数:17,代码来源:NodeGestures.java

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