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

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

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

Node.relocate介绍

暂无

代码示例

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

  1. mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
  2. break;
  3. default:

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

  1. @Override
  2. public void relocate(Node node, double b0, double l0) {
  3. node.relocate(b0, l0);
  4. }

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

  1. @Override
  2. public void relocate(Node node, double b0, double l0) {
  3. node.relocate(l0, b0);
  4. }

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

  1. /**
  2. *
  3. * @param progress
  4. * @param animationLayoutInfo
  5. */
  6. @Implements(interfaces=AnimationInterpolation.class)
  7. static public void animateFromTheOrigin(double progress, AnimationLayoutInfo animationLayoutInfo) {
  8. double lOX = animationLayoutInfo.originX - (animationLayoutInfo.layoutInfo.beadDiameter / 2);
  9. double lOY = animationLayoutInfo.originY - (animationLayoutInfo.layoutInfo.beadDiameter / 2);
  10. double lX = lOX + (progress * (animationLayoutInfo.nodeLayoutInfo.x - lOX));
  11. double lY = lOY + (progress * (animationLayoutInfo.nodeLayoutInfo.y - lOY));
  12. animationLayoutInfo.node.relocate(lX, lY);
  13. }

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

  1. /**
  2. *
  3. * @param progress
  4. * @param animationLayoutInfo
  5. */
  6. @Implements(interfaces=AnimationInterpolation.class)
  7. static public void animateAppear(double progress, AnimationLayoutInfo animationLayoutInfo) {
  8. animationLayoutInfo.node.setOpacity(progress);
  9. animationLayoutInfo.node.relocate(animationLayoutInfo.nodeLayoutInfo.x, animationLayoutInfo.nodeLayoutInfo.y);
  10. }

代码示例来源:origin: com.guigarage/animations

  1. @Override
  2. protected void layoutChildren() {
  3. super.layoutChildren();
  4. for(Node child : getChildren()) {
  5. if(!child.equals(playIcon) && !child.equals(pauseIcon)) {
  6. child.relocate(0, 0);
  7. child.resize(getWidth(), getHeight());
  8. }
  9. }
  10. }
  11. }

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

  1. /**
  2. *
  3. * @param progress
  4. * @param animationLayoutInfo
  5. */
  6. @Implements(interfaces=AnimationInterpolation.class)
  7. static public void animateOverTheArc(double progress, AnimationLayoutInfo animationLayoutInfo) {
  8. double lAngle = animationLayoutInfo.layoutInfo.startAngle + (progress * (animationLayoutInfo.nodeLayoutInfo.angle - animationLayoutInfo.layoutInfo.startAngle));
  9. double lX = calculateX(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2)
  10. - (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center
  11. - animationLayoutInfo.layoutInfo.clipLeft
  12. ;
  13. double lY = calculateY(animationLayoutInfo.layoutInfo.chainDiameter, lAngle) + (animationLayoutInfo.layoutInfo.beadDiameter / 2)
  14. - (animationLayoutInfo.nodeLayoutInfo.w / 2) // add the difference between the bead's size and the node's, so it ends up in the center
  15. - animationLayoutInfo.layoutInfo.clipTop
  16. ;
  17. animationLayoutInfo.node.relocate(lX, lY);
  18. }

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

  1. Node graphicsNode = collect.get(0);
  2. graphicsNode.autosize();
  3. graphicsNode.relocate(0, 0);
  4. } else {
  5. double start = 0;
  6. for (Node n : collect) {
  7. n.autosize();
  8. n.relocate(start, 0);
  9. start += n.prefWidth(-1);
  10. Node graphicsNode = collect.get(0);
  11. graphicsNode.autosize();
  12. graphicsNode.relocate(getWidth()-graphicsNode.prefWidth(-1), 0);
  13. for (Node n : collect) {
  14. n.autosize();
  15. n.relocate(getWidth()-n.prefWidth(-1) - start, 0);
  16. start += n.prefWidth(-1);
  17. Node graphicsNode = collect.get(0);
  18. graphicsNode.autosize();
  19. graphicsNode.relocate(0, getHeight() - graphicsNode.prefHeight(-1));
  20. } else {
  21. double start = 0;
  22. for (Node n : collect) {
  23. n.autosize();
  24. n.relocate(start, getHeight() - n.prefHeight(-1));
  25. start += n.prefWidth(-1);

代码示例来源: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: stackoverflow.com

  1. double deltaX = event.getSceneX() - mouseAnchor.get().getX();
  2. double deltaY = event.getSceneY() - mouseAnchor.get().getY();
  3. node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY);
  4. mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));;
  5. });

代码示例来源: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: stackoverflow.com

  1. node.relocate(x + 10, y - node.prefHeight(Integer.MAX_VALUE) / 2);
  2. node.autosize();

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

  1. for (Data<X, Y> horizontalMarker : horizontalMarkers) {
  2. Line line = (Line) horizontalMarker.getNode();
  3. line.setStartX(0);
  4. line.setEndX(getBoundsInLocal().getWidth());
  5. line.setStartY(getYAxis().getDisplayPosition(horizontalMarker.getYValue()) + 0.5); // 0.5 for crispness
  6. line.setEndY(line.getStartY());
  7. line.toFront();
  8. Node text = nodeMap.get(line);
  9. text.relocate(line.getBoundsInParent().getMinX() + line.getBoundsInParent().getWidth()/2 - text.prefWidth(-1) / 2, line.getBoundsInParent().getMinY() - 30);
  10. }

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

  1. node.setOnMouseDragged(mouseEvent -> node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y));

代码示例来源:origin: org.controlsfx/controlsfx

  1. @Override protected void layoutChildren(double x, double y, double w, double h) {
  2. for (int i = 0; i < getChildren().size(); i++) {
  3. Node n = getChildren().get(i);
  4. double nw = snapSize(n.prefWidth(h));
  5. double nh = snapSize(n.prefHeight(-1));
  6. if (i > 0) {
  7. // We have to position the bread crumbs slightly overlapping
  8. double ins = n instanceof BreadCrumbButton ? ((BreadCrumbButton)n).getArrowWidth() : 0;
  9. x = snapPosition(x - ins);
  10. }
  11. n.resize(nw, nh);
  12. n.relocate(x, y);
  13. x += nw;
  14. }
  15. }

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

  1. double deltaX = event.getSceneX() - mouseAnchor.get().getX();
  2. double deltaY = event.getSceneY() - mouseAnchor.get().getY();
  3. node.relocate(node.getLayoutX()+deltaX, node.getLayoutY()+deltaY);
  4. mouseAnchor.set(new Point2D(event.getSceneX(), event.getSceneY()));;
  5. });

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

  1. node.relocate( mouseEvent.getScreenX() + dragDelta.x, mouseEvent.getScreenY() + dragDelta.y);
  2. circlePane.update();

代码示例来源:origin: no.tornado/tornadofx-controls

  1. if (graphic != null) {
  2. double centeredX = x + (w / 2) - graphic.getLayoutBounds().getWidth() / 2;
  3. graphic.relocate(centeredX, y);
  4. y += Math.max(graphic.getLayoutBounds().getHeight(), graphicFixedSize());
  5. graphic.relocate(centeredX, y);
  6. if (graphic != null) {
  7. double centeredY = y + (h / 2) - graphic.getLayoutBounds().getHeight() / 2;
  8. graphic.relocate(x, centeredY);

代码示例来源:origin: org.controlsfx/controlsfx

  1. @Override protected void layoutChildren(double x, double y, double w, double h) {
  2. // double currentWidth = getSkinnable().getWidth();
  3. double cellWidth = getSkinnable().gridViewProperty().get().getCellWidth();
  4. double cellHeight = getSkinnable().gridViewProperty().get().getCellHeight();
  5. double horizontalCellSpacing = getSkinnable().gridViewProperty().get().getHorizontalCellSpacing();
  6. double verticalCellSpacing = getSkinnable().gridViewProperty().get().getVerticalCellSpacing();
  7. double xPos = 0;
  8. double yPos = 0;
  9. // This has been commented out as I removed the API from GridView until
  10. // a use case was created.
  11. // HPos currentHorizontalAlignment = getSkinnable().gridViewProperty().get().getHorizontalAlignment();
  12. // if (currentHorizontalAlignment != null) {
  13. // if (currentHorizontalAlignment.equals(HPos.CENTER)) {
  14. // xPos = (currentWidth % computeCellWidth()) / 2;
  15. // } else if (currentHorizontalAlignment.equals(HPos.RIGHT)) {
  16. // xPos = currentWidth % computeCellWidth();
  17. // }
  18. // }
  19. for (Node child : getChildren()) {
  20. child.relocate(xPos + horizontalCellSpacing, yPos + verticalCellSpacing);
  21. child.resize(cellWidth, cellHeight);
  22. xPos = xPos + horizontalCellSpacing + cellWidth + horizontalCellSpacing;
  23. }
  24. }
  25. }

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

  1. mask.relocate(bounds.getMinX() + diffMinX, bounds.getMinY() + diffMinY);
  2. break;
  3. default:

相关文章

Node类方法