javafx.scene.Node.getLayoutY()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(203)

本文整理了Java中javafx.scene.Node.getLayoutY()方法的一些代码示例,展示了Node.getLayoutY()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLayoutY()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getLayoutY

Node.getLayoutY介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateY(contentContainer.getLayoutY()
  5. + contentContainer.getLayoutBounds().getMaxY());
  6. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateY(-(contentContainer.getLayoutY()
  5. + contentContainer.getLayoutBounds().getMaxY()));
  6. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) {
  2. super(contentContainer, new Timeline(
  3. new KeyFrame(Duration.ZERO,
  4. new KeyValue(contentContainer.translateYProperty(),
  5. (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())
  6. * (topDirection? -1 : 1), Interpolator.LINEAR),
  7. new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
  8. ),
  9. new KeyFrame(Duration.millis(1000),
  10. new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
  11. new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT)
  12. )));
  13. // reduce the number to increase the shifting , increase number to reduce shifting
  14. setCycleDuration(Duration.seconds(0.4));
  15. setDelay(Duration.seconds(0));
  16. }
  17. }

代码示例来源:origin: org.fxmisc.flowless/flowless

  1. @Override
  2. public double layoutX(Node node) {
  3. return node.getLayoutY();
  4. }

代码示例来源:origin: org.fxmisc.flowless/flowless

  1. @Override
  2. public double layoutY(Node node) {
  3. return node.getLayoutY();
  4. }

代码示例来源:origin: stackoverflow.com

  1. import javafx.scene.Node;
  2. import javafx.scene.paint.Paint;
  3. import javafx.scene.shape.Rectangle;
  4. public class City extends Rectangle {
  5. public City(final Node node) {
  6. super(node.getLayoutX(), node.getLayoutY(), 32, 32);
  7. this.setFill(Paint.valueOf("BLUE"));
  8. }
  9. }

代码示例来源:origin: stackoverflow.com

  1. //gets the display region of the chart
  2. Node chartPlotArea = chart.lookup(".chart-plot-background");
  3. double chartZeroX = chartPlotArea.getLayoutX();
  4. double chartZeroY = chartPlotArea.getLayoutY();

代码示例来源:origin: stackoverflow.com

  1. private void clickOnMe(ObservableList<Node> nodes){
  2. for(Node n : nodes){
  3. n.fireEvent(new MouseEvent(MouseEvent.MOUSE_CLICKED,
  4. n.getLayoutX(), n.getLayoutY(), n.getLayoutX(), n.getLayoutY(), MouseButton.PRIMARY, 1,
  5. true, true, true, true, true, true, true, true, true, true, null));
  6. }
  7. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. @Override
  2. protected double computeValue() {
  3. return senderNode.getLayoutY()
  4. + senderNode.getTranslateY()
  5. + senderShape.getRadius();
  6. }
  7. };

代码示例来源:origin: com.jfoenix/jfoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateY(contentContainer.getLayoutY()
  5. + contentContainer.getLayoutBounds().getMaxY());
  6. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. @Override
  2. public void initAnimation(Node contentContainer, Node overlay) {
  3. overlay.setOpacity(0);
  4. contentContainer.setTranslateY(-(contentContainer.getLayoutY()
  5. + contentContainer.getLayoutBounds().getMaxY()));
  6. }

代码示例来源:origin: com.miglayout/miglayout-javafx

  1. private static Rectangle2D getBounds(Node node)
  2. {
  3. Bounds lBounds = node.getLayoutBounds();
  4. return new Rectangle2D(
  5. node.getLayoutX(),
  6. node.getLayoutY(),
  7. lBounds.getWidth(),
  8. lBounds.getHeight()
  9. );
  10. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. @Override
  2. protected void layoutChildren() {
  3. getParent().requestLayout();
  4. super.layoutChildren();
  5. for (Node n : getManagedChildren()) {
  6. if (n instanceof Region) {
  7. Region p = (Region) n;
  8. double width = Math.max(p.getMinWidth(), p.getPrefWidth());
  9. double height = Math.max(p.getMinHeight(), p.getPrefHeight());
  10. n.resize(width, height);
  11. double nX = Math.min(0, n.getLayoutX());
  12. double nY = Math.min(0, n.getLayoutY());
  13. n.relocate(nX, nY);
  14. }
  15. }
  16. }

代码示例来源:origin: org.jfxtras/jfxtras-test-support

  1. public AssertNode assertXYWH(double x, double y, double w, double h, double accuracy) {
  2. Assert.assertEquals(description + ", X", x, node.getLayoutX(), accuracy);
  3. Assert.assertEquals(description + ", Y", y, node.getLayoutY(), accuracy);
  4. Assert.assertEquals(description + ", W", w, width(node), accuracy);
  5. Assert.assertEquals(description + ", H", h, height(node), accuracy);
  6. return this;
  7. }

代码示例来源:origin: stackoverflow.com

  1. EventHandler<MouseEvent> onMouseReleasedEventHandler = new EventHandler<MouseEvent>() {
  2. @Override
  3. public void handle(MouseEvent t) {
  4. fixPosition((Node) t.getSource());
  5. }
  6. };
  7. resource.setOnMouseReleased(onMouseReleasedEventHandler);
  8. private void fixPosition( Node node) {
  9. double x = node.getTranslateX();
  10. double y = node.getTranslateY();
  11. node.relocate(node.getLayoutX() + x, node.getLayoutY() + y);
  12. node.setTranslateX(0);
  13. node.setTranslateY(0);
  14. }

代码示例来源:origin: com.guigarage/ui-basics

  1. public static Group convertTo3D(Node node, int depth) {
  2. Group root = new Group();
  3. root.setTranslateX(node.getLayoutX());
  4. root.setTranslateY(node.getLayoutY());
  5. root.setTranslateZ(-20);
  6. System.out.println("Layer " + depth + " - Node Type: " + node.getClass());
  7. Box box = new Box(node.getBoundsInParent().getWidth(), node.getBoundsInParent().getHeight(), 0.1);
  8. box.setTranslateX(node.getLayoutX());
  9. box.setTranslateY(node.getLayoutY());
  10. SnapshotParameters snapshotParameters = new SnapshotParameters();
  11. snapshotParameters.setFill(Color.TRANSPARENT);
  12. box.setMaterial(new PhongMaterial(Color.WHITE, node.snapshot(snapshotParameters, new WritableImage((int) node.getBoundsInParent().getWidth(), (int) node.getBoundsInParent().getHeight())), null, null, null));
  13. root.getChildren().add(box);
  14. if (node instanceof Parent) {
  15. for (Node child : ((Parent) node).getChildrenUnmodifiable()) {
  16. root.getChildren().add(convertTo3D(child, depth + 1));
  17. }
  18. }
  19. return root;
  20. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. protected void initSenderAndReceiver() {
  2. receiverConnectorUI = new Circle(15);
  3. final VNode sender = getSender().getNode();
  4. final FXFlowNodeSkin senderSkin = (FXFlowNodeSkin) getController().
  5. getNodeSkinLookup().getById(skinFactory, sender.getId());
  6. senderShape = senderSkin.getConnectorShape(getSender());
  7. final Node senderNode = senderShape.getNode();
  8. senderConnectorUI = senderShape;
  9. receiverConnectorUI.setLayoutX(senderNode.getLayoutX()
  10. +receiverConnectorUI.getRadius());
  11. receiverConnectorUI.setLayoutY(senderNode.getLayoutY()
  12. +receiverConnectorUI.getRadius());
  13. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. public void performDragBegin(
  2. Node n, MouseEvent event) {
  3. final double parentScaleX = n.getParent().
  4. localToSceneTransformProperty().getValue().getMxx();
  5. final double parentScaleY = n.getParent().
  6. localToSceneTransformProperty().getValue().getMyy();
  7. // record the current mouse X and Y position on Node
  8. mouseX = event.getSceneX();
  9. mouseY = event.getSceneY();
  10. if (centerNode) {
  11. Point2D p2d = n.getParent().sceneToLocal(mouseX, mouseY);
  12. nodeX = p2d.getX();
  13. nodeY = p2d.getY();
  14. } else {
  15. nodeX = n.getLayoutX() * parentScaleX;
  16. nodeY = n.getLayoutY() * parentScaleY;
  17. }
  18. n.toFront();
  19. }
  20. }

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

  1. protected void initMaterialNodeDrag() {
  2. final Delta dragDelta = new Delta();
  3. materialNode.setOnMousePressed(mouseEvent -> {
  4. AnchorPane.setTopAnchor(materialNode, null);
  5. AnchorPane.setBottomAnchor(materialNode, null);
  6. AnchorPane.setRightAnchor(materialNode, null);
  7. // record a delta distance for the drag and drop operation.
  8. dragDelta.x = materialNode.getLayoutX() - mouseEvent.getSceneX();
  9. dragDelta.y = materialNode.getLayoutY() - mouseEvent.getSceneY();
  10. materialNode.setCursor(Cursor.MOVE);
  11. });
  12. materialNode.setOnMouseReleased(mouseEvent -> materialNode.setCursor(Cursor.HAND));
  13. materialNode.setOnMouseDragged(mouseEvent -> {
  14. materialNode.setLayoutX(mouseEvent.getSceneX() + dragDelta.x);
  15. materialNode.setLayoutY(mouseEvent.getSceneY() + dragDelta.y);
  16. });
  17. materialNode.setOnMouseEntered(mouseEvent -> materialNode.setCursor(Cursor.HAND));
  18. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) {
  2. super(contentContainer, new Timeline(
  3. new KeyFrame(Duration.ZERO,
  4. new KeyValue(contentContainer.translateYProperty(),
  5. (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())
  6. * (topDirection? -1 : 1), Interpolator.LINEAR),
  7. new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH)
  8. ),
  9. new KeyFrame(Duration.millis(1000),
  10. new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH),
  11. new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT)
  12. )));
  13. // reduce the number to increase the shifting , increase number to reduce shifting
  14. setCycleDuration(Duration.seconds(0.4));
  15. setDelay(Duration.seconds(0));
  16. }
  17. }

相关文章

Node类方法