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

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

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

Node.getBoundsInParent介绍

暂无

代码示例

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

  1. @Override
  2. protected boolean handleDisclosureNode(double x, double y) {
  3. final TreeItem<S> treeItem = getControl().getTreeTableRow().getTreeItem();
  4. if (!treeItem.isLeaf()) {
  5. final Node disclosureNode = getControl().getTreeTableRow().getDisclosureNode();
  6. if (disclosureNode != null) {
  7. if (disclosureNode.getBoundsInParent().contains(x + disclosureNode.getTranslateX(), y)) {
  8. if (treeItem != null) {
  9. treeItem.setExpanded(!treeItem.isExpanded());
  10. }
  11. return true;
  12. }
  13. }
  14. }
  15. return false;
  16. }
  17. }

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

  1. OverLayRipple() {
  2. super();
  3. setOverLayBounds(this);
  4. this.getStyleClass().add("jfx-rippler-overlay");
  5. // update initial position
  6. if(JFXRippler.this.getChildrenUnmodifiable().contains(control)) {
  7. double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX());
  8. double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY());
  9. Bounds bounds = control.getBoundsInParent();
  10. this.setX(bounds.getMinX() + diffMinX - snappedLeftInset());
  11. this.setY(bounds.getMinY() + diffMinY - snappedTopInset());
  12. }
  13. // set initial attributes
  14. setOpacity(0);
  15. setCache(true);
  16. setCacheHint(CacheHint.SPEED);
  17. setCacheShape(true);
  18. setManaged(false);
  19. }
  20. }

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

  1. private static Timeline createTimeline(JFXHamburger burger) {
  2. double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
  3. double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
  4. .get(0)
  5. .getBoundsInParent()
  6. .getMinY();
  7. 2) + Math.pow(burger.getChildren()
  8. .get(0)
  9. .getBoundsInParent()
  10. .getWidth() / 2, 2));
  11. double theta = (90 - angle) + Math.toDegrees(Math.atan((burger.getChildren()
  12. .getHeight()) / (burger.getChildren()
  13. .get(0)
  14. .getBoundsInParent()
  15. .getWidth() / 2)));
  16. double hOffset = Math.cos(Math.toRadians(theta)) * burgerDiagonal / 2;

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

  1. private static Timeline createTimeline(JFXHamburger burger) {
  2. double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
  3. double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
  4. .get(0)
  5. .getBoundsInParent()
  6. .getMinY();
  7. 2) + Math.pow(burger.getChildren()
  8. .get(0)
  9. .getBoundsInParent()
  10. .getWidth() / 2, 2));
  11. double theta = (90 - angle) + Math.toDegrees(Math.atan((burger.getChildren()
  12. .getHeight()) / (burger.getChildren()
  13. .get(0)
  14. .getBoundsInParent()
  15. .getWidth() / 2)));
  16. double hOffset = Math.cos(Math.toRadians(theta)) * burgerDiagonal / 2;

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

  1. Bounds bounds = control.getBoundsInParent();
  2. double width = control.getLayoutBounds().getWidth();
  3. double height = control.getLayoutBounds().getHeight();

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

  1. private static Timeline createTimeline(JFXHamburger burger) {
  2. double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
  3. double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
  4. .get(0)
  5. .getBoundsInParent()
  6. .getMinY();

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

  1. private static Timeline createTimeline(JFXHamburger burger) {
  2. double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth();
  3. double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren()
  4. .get(0)
  5. .getBoundsInParent()
  6. .getMinY();

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

  1. public void centerNodeInScrollPane(ScrollPane scrollPane, Node node) {
  2. double h = scrollPane.getContent().getBoundsInLocal().getHeight();
  3. double y = (node.getBoundsInParent().getMaxY() +
  4. node.getBoundsInParent().getMinY()) / 2.0;
  5. double v = scrollPane.getViewportBounds().getHeight();
  6. scrollPane.setVvalue(scrollPane.getVmax() * ((y - 0.5 * v) / (h - v)));
  7. }

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

  1. calcCenter(node.getBoundsInParent());
  2. node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() {
  3. @Override public void changed(

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

  1. @Override
  2. protected double computeMinWidth(double h) {
  3. double minX = Double.MAX_VALUE;
  4. double maxX = Double.MIN_VALUE;
  5. for (Node n : getManagedChildren()) {
  6. minX = Math.min(minX, n.getBoundsInParent().getMinX());
  7. maxX = Math.max(maxX, n.getBoundsInParent().getMaxX());
  8. }
  9. return maxX;
  10. }

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

  1. @Override
  2. protected double computeMinHeight(double w) {
  3. double minY = Double.MAX_VALUE;
  4. double maxY = Double.MIN_VALUE;
  5. for (Node n : getManagedChildren()) {
  6. minY = Math.min(minY, n.getBoundsInParent().getMinY());
  7. maxY = Math.max(maxY, n.getBoundsInParent().getMaxY());
  8. }
  9. return maxY;
  10. }

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

  1. public <T extends Node & Caret> Bounds getCaretBounds(T caret) {
  2. layout(); // ensure layout, is a no-op if not dirty
  3. checkWithinParagraph(caret);
  4. return caret.getBoundsInParent();
  5. }

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

  1. /**
  2. * Resizes the specified rectangle to the specified node's {@link Node#boundsInParentProperty() boundsInParent}.
  3. *
  4. * @param rectangle
  5. * the {@link Rectangle} which will be resized
  6. * @param node
  7. * the {@link Node} to whose bounds the {@code rectangle} will be resized
  8. */
  9. private static void resizeRectangleToNodeBounds(Rectangle rectangle, Node node) {
  10. if (node == null) {
  11. resizeRectangleToZero(rectangle);
  12. } else {
  13. resizeRectangleToBounds(rectangle, node.getBoundsInParent());
  14. }
  15. }

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

  1. public Collection<? extends HoverTarget> findHoverTargets(Point2D localLocation) {
  2. return this.usedNodes.entrySet().stream()
  3. .filter(e->e.getValue().getBoundsInParent().contains(localLocation))
  4. .map(e->{
  5. TextAnnotation annotation = e.getKey();
  6. Bounds bounds = e.getValue().getBoundsInLocal();
  7. Point2D anchor = new Point2D(bounds.getMinX(), bounds.getMaxY());
  8. HoverTarget annotationTarget = new HoverTarget(annotation, toGlobal(annotation.getRange()), e.getValue().localToScreen(anchor), e.getValue().localToScreen(bounds));
  9. return annotationTarget;
  10. })
  11. .collect(Collectors.toList());
  12. }

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

  1. private static void ensureVisible(ScrollPane pane, Node node) {
  2. Bounds viewport = pane.getViewportBounds();
  3. double contentHeight = pane.getContent().getBoundsInLocal().getHeight();
  4. double nodeMinY = node.getBoundsInParent().getMinY();
  5. double nodeMaxY = node.getBoundsInParent().getMaxY();
  6. double viewportMinY = (contentHeight - viewport.getHeight()) * pane.getVvalue();
  7. double viewportMaxY = viewportMinY + viewport.getHeight();
  8. if (nodeMinY < viewportMinY) {
  9. pane.setVvalue(nodeMinY / (contentHeight - viewport.getHeight()));
  10. } else if (nodeMaxY > viewportMaxY) {
  11. pane.setVvalue((nodeMaxY - viewport.getHeight()) / (contentHeight - viewport.getHeight()));
  12. }
  13. }

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

  1. /**
  2. * To bounds X.
  3. *
  4. * @param aTranslateX the translate X
  5. * @param aSprite the sprite
  6. * @return the double
  7. */
  8. private double toBoundsX( double aTranslateX, Node aSprite ) {
  9. return toBounds( aTranslateX, aSprite.getBoundsInParent().getWidth(), _scene.getWidth() );
  10. }

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

  1. /**
  2. * To bounds Y.
  3. *
  4. * @param aTranslateY the translate Y
  5. * @param aSprite the sprite
  6. * @return the double
  7. */
  8. private double toBoundsY( double aTranslateY, Node aSprite ) {
  9. return toBounds( aTranslateY, aSprite.getBoundsInParent().getHeight(), _scene.getHeight() );
  10. }

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

  1. /**
  2. * To snap X.
  3. *
  4. * @param aTranslateX the translate X
  5. * @param aSprite the sprite
  6. * @return the double
  7. */
  8. private double toSnapX( double aTranslateX, Node aSprite ) {
  9. return toSnap( aTranslateX, aSprite.getBoundsInParent().getWidth(), getFieldWidth(), _scene.getWidth() );
  10. }

代码示例来源:origin: org.refcodes/refcodes-graphical-ext-javafx

  1. /**
  2. * To snap Y.
  3. *
  4. * @param aTranslateY the translate Y
  5. * @param aSprite the sprite
  6. * @return the double
  7. */
  8. private double toSnapY( double aTranslateY, Node aSprite ) {
  9. return toSnap( aTranslateY, aSprite.getBoundsInParent().getHeight(), getFieldHeight(), _scene.getHeight() );
  10. }

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

  1. /**
  2. * Resizes the current {@link SnapshotView#selectionProperty() selection} from the control's to the node's
  3. * bounds
  4. */
  5. private void resizeSelectionFromControlToNode() {
  6. if (getNode() == null) {
  7. setSelection(null);
  8. } else {
  9. // transform the selection from the control's to the node's bounds
  10. Rectangle2D controlBounds = new Rectangle2D(0, 0, getWidth(), getHeight());
  11. Rectangle2D nodeBounds = Rectangles2D.fromBounds(getNode().getBoundsInParent());
  12. resizeSelectionToNewBounds(controlBounds, nodeBounds);
  13. }
  14. }

相关文章

Node类方法