當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。