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


Java Node.getLayoutX方法代码示例

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


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

示例1: SeparatedStage

import javafx.scene.Node; //导入方法依赖的package包/类
SeparatedStage(Node node){
	super();
	position = new Point2D(node.getLayoutX(),node.getLayoutY());
	root.getChildren().add(node);
	//scene.setFill(Color.WHITE);
	this.node = node;
	setOnShowing(showHandler);
	setOnHiding(showHandler);
	root.setOnMouseDragged(startDragHandler);
	root.setOnMouseExited(stopDragHandler);
	root.setOnMouseReleased(stopDragHandler);
	setAlwaysOnTop();
	try {
		node.setLayoutX(0);
		node.setLayoutY(0);
	} catch (Exception e){ }
	show();
	stage.setX(position.getX());
	stage.setY(position.getY());
	Bounds bounds = node.getLayoutBounds();
	stage.setHeight(bounds.getHeight()+5);
	stage.setWidth(bounds.getWidth()+5);

}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:25,代码来源:OverlayStage.java

示例2: layoutChildren

import javafx.scene.Node; //导入方法依赖的package包/类
@Override protected void layoutChildren() {
    final double w = getWidth();
    final double h = getHeight();
    clipRect.setWidth(w);
    clipRect.setHeight(h);
    for (Node child : getChildren()) {
        if (child == postView) {
            postView.relocate(w - 15 - postView.getLayoutBounds().getWidth(), 0);
        } else if (child.getLayoutX() == 0 && child.getLayoutY() == 0) {
            final double iw = child.getBoundsInParent().getWidth();
            final double ih = child.getBoundsInParent().getHeight();
            child.setLayoutX((w - iw) * Math.random() + 100);
            child.setLayoutY((h - ih) * Math.random() + 100);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:17,代码来源:MultiTouchSample.java

示例3: press

import javafx.scene.Node; //导入方法依赖的package包/类
private void press(MouseEvent e) {
  Node node = get();
  if (isEnable() && e.isConsumed() == false && node != null) {
    Corner corner = calcCorner(e);
    if (corner != Corner.CENTER) {
      pressedCorner = corner;
      startX = e.getScreenX();
      startY = e.getScreenY();
      startWidth = width.get() == -1 ? node.prefWidth(-1) : width.get();
      startHeight = height.get() == -1 ? node.prefHeight(-1) : height.get();
      startPosX = node.getLayoutX();
      startPosY = node.getLayoutY();
      e.consume();
    }
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:17,代码来源:ResizeSupport.java

示例4: makeLocationScale

import javafx.scene.Node; //导入方法依赖的package包/类
private static void makeLocationScale(Scene scene, Node node) {
    double nodeX = node.getLayoutX();
    double sceneWidth = scene.getWidth();
    double nodeY = node.getLayoutY();
    double sceneHeight = scene.getHeight();
    if (nodeX != 0.0) {
        ChangeListener<Number> xResizer = (arg0, oldValue, newValue) -> node.relocate(nodeX / sceneWidth * newValue.doubleValue(), node.getLayoutY());
        scene.widthProperty().addListener(xResizer);
    }
    if (nodeY != 0.0) {
        ChangeListener<Number> yResizer = (arg0, oldValue, newValue) -> node.relocate(node.getLayoutX(), nodeY / sceneHeight * newValue.doubleValue());
        scene.heightProperty().addListener(yResizer);
    }
}
 
开发者ID:ciphertechsolutions,项目名称:IO,代码行数:15,代码来源:BaseController.java

示例5: onPressed

import javafx.scene.Node; //导入方法依赖的package包/类
private void onPressed(Node dragged, MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY) {
        dragActive = true;
        inertiaOvercome = false;
        nodeXOnPress = dragged.getLayoutX();
        mouseXOnPress = event.getScreenX();

        minWidthBackup = container.getMinWidth();
        prefWidthBackup = container.getPrefWidth();
        maxWidthBackup = container.getMaxWidth();
        container.setMinWidth(container.getWidth());
        container.setPrefWidth(container.getWidth());
        container.setMaxWidth(container.getWidth());

        translates = moveableChildren().collect(Collectors.toMap(Function.identity(), child -> new TranslateAnimation(child, dragged)));
        moveableChildren().forEach(child -> child.setManaged(false));

        // Move dragged node temporarily to front. Reset to original index on mouse release.
        dragged.toFront();
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:22,代码来源:KeyFrameDragAnimator.java

示例6: TranslateAnimation

import javafx.scene.Node; //导入方法依赖的package包/类
public TranslateAnimation(Node child, Node dragged) {
    initialX = child.getLayoutX();
    initialIndex = container.getChildren().indexOf(child);
    if (child != dragged) {
        translate = new TranslateTransition(DURATION, child);

        double displacement = dragged.getLayoutBounds().getWidth() + container.getSpacing();
        if (initialIndex < container.getChildren().indexOf(dragged)) {
            translate.setFromX(0);
            translate.setToX(displacement);
        } else {
            translate.setFromX(-displacement);
            translate.setToX(0);
            translate.jumpTo(DURATION);
            forward.set(true);
        }

        forward.addListener((v, o, n) -> {
            translate.setRate(n ? 1 : -1);
            translate.play();
        });
    } else {
        translate = null;
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:26,代码来源:KeyFrameDragAnimator.java

示例7: press

import javafx.scene.Node; //导入方法依赖的package包/类
@Override
public void press(MouseEvent e) {
  Node node = get();
  if (isEnable() && e.isConsumed() == false && node != null) {
    Bounds boundsInLocal = node.getBoundsInLocal();
    if (canDrag(node.screenToLocal(e.getScreenX(), e.getScreenY()), boundsInLocal.getMaxX(), boundsInLocal.getMaxY())) {
      startX = e.getScreenX() - node.getLayoutX();
      startY = e.getScreenY() - node.getLayoutY();
      e.consume();
      pressed = true;
    }
  }
}
 
开发者ID:XDean,项目名称:JavaFX-EX,代码行数:14,代码来源:DragSupport.java


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