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

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

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

Node.localToScreen介绍

暂无

代码示例

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

  1. Node node = ...
  2. Point2D screenCoordiantes = node.localToScreen(localX, localY);

代码示例来源: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: org.fxmisc.richtext/richtextfx

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

代码示例来源:origin: com.cedarsoft.commons/javafx

  1. private void show(@Nonnull Node parent) {
  2. Bounds bounds = parent.localToScreen(parent.getLayoutBounds());
  3. show(parent, bounds.getMinX() + 5, bounds.getMinY() + bounds.getHeight() + 5);
  4. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> moveTo(Duration d, double x, double y) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Move.to(d,bounds.getMinX() + x, bounds.getMinY() + y));
  5. return null;
  6. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> moveTo(double x, double y) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Move.to(bounds.getMinX() + x, bounds.getMinY() + y));
  5. return this;
  6. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> dragTo(double x, double y) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Drag.to(bounds.getWidth() / 2, bounds.getHeight() / 2, x, y));
  5. return this;
  6. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> dragTo(Duration d, double x, double y) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Drag.to(d, bounds.getWidth() / 2, bounds.getHeight() / 2, x, y));
  5. return this;
  6. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public Point2D center() {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. return new Point2D(bounds.getMinX() + bounds.getWidth()/2, bounds.getMinY() + bounds.getHeight()/2);
  5. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> dragBy(double dx, double dy) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Drag.by( bounds.getMinX() + bounds.getWidth() / 2, bounds.getMinY() + bounds.getHeight() / 2, dx, dy));
  5. return this;
  6. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. @Override
  2. public RNode<T> dragBy(Duration d, double dx, double dy) {
  3. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  4. controller.run(Drag.by(d, bounds.getMinX() + bounds.getWidth() / 2, bounds.getMinY() + bounds.getHeight() / 2, dx, dy));
  5. return this;
  6. }

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

  1. /**
  2. * Sets up the code to fire a {@code BEGIN} event when the mouse becomes stationary over the node and has not
  3. * moved for the given amount of time ({@code delay}), and to fire a {@code END} event when the stationary
  4. * mouse moves again. Note: any previously installed delays will be removed without creating memory leaks.
  5. */
  6. public void install(Duration delay) {
  7. if(installed != null) {
  8. installed.unsubscribe();
  9. }
  10. installed = events(delay).<Event>map(either -> either.unify(
  11. pos -> MouseStationaryEvent.beginAt(node.localToScreen(pos)),
  12. stop -> MouseStationaryEvent.end()))
  13. .subscribe(evt -> Event.fireEvent(node, evt));
  14. }

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. double y;
  2. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  3. switch (position.getHpos()) {
  4. case CENTER:

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. double y;
  2. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  3. switch (referencePoint.getHpos()) {
  4. case CENTER:

代码示例来源:origin: at.bestsolution.fx.test/at.bestsolution.fx.test.rcontrol

  1. double y;
  2. Bounds bounds = node.localToScreen(node.getBoundsInLocal());
  3. switch (referencePoint.getHpos()) {
  4. case CENTER:

代码示例来源:origin: org.tentackle/tentackle-fx

  1. /**
  2. * Updates the location when the effective size is known.
  3. */
  4. protected void updateLocation() {
  5. Bounds linkedNodeBounds = linkedNode.localToScreen(linkedNode.getBoundsInLocal());
  6. Point2D linkedNodeLocation = linkedNode.localToScreen(0.0, 0.0);
  7. if (linkedNodeBounds != null && linkedNodeLocation != null) {
  8. switch (note.getPosition()) {
  9. case BOTTOM:
  10. note.setAnchorX(linkedNodeLocation.getX() + linkedNodeBounds.getWidth() / 2 - note.getWidth() / 2);
  11. note.setAnchorY(linkedNodeLocation.getY() + linkedNodeBounds.getHeight() - CIRCLE_RADIUS);
  12. break;
  13. case TOP:
  14. note.setAnchorX(linkedNodeLocation.getX() + linkedNodeBounds.getWidth() / 2 - note.getWidth() / 2);
  15. note.setAnchorY(linkedNodeLocation.getY() - note.getHeight() + CIRCLE_RADIUS);
  16. break;
  17. case LEFT:
  18. note.setAnchorX(linkedNodeLocation.getX() - note.getWidth() + CIRCLE_RADIUS);
  19. note.setAnchorY(linkedNodeLocation.getY() + linkedNodeBounds.getHeight() / 2 - note.getHeight() / 2);
  20. break;
  21. default: // RIGHT
  22. note.setAnchorX(linkedNodeLocation.getX() + linkedNodeBounds.getWidth() - CIRCLE_RADIUS);
  23. note.setAnchorY(linkedNodeLocation.getY() + linkedNodeBounds.getHeight() / 2 - note.getHeight() / 2);
  24. }
  25. }
  26. }

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

  1. requireNonNull(owner);
  2. Bounds bounds = owner.localToScreen(owner.getBoundsInLocal());

相关文章

Node类方法