javafx.scene.Scene.getY()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(99)

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

Scene.getY介绍

暂无

代码示例

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

public void moveCircle(Circle circle, Scene scene) {
  Timer timer = new Timer();
  timer.scheduleAtFixedRate(new TimerTask() {
    @Override
    public void run() {
      Platform.runLater(() -> {
        circle.setCenterX(random((int) scene.getX()));
        circle.setCenterY(random((int) scene.getY()));
      });
    }
  }, 1000, 1000);
}

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

private void updateY() {
  Window stage = getOwner();
  setY(stage.getY() + stage.getScene().getY());
}

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

public void moveCircle(Circle circle, Scene scene) {
  Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(1), ev -> {
    circle.setCenterX(random((int) scene.getX()));
    circle.setCenterY(random((int) scene.getY()));
  }));
  timeline.setCycleCount(Animation.INDEFINITE);
  timeline.play();
}

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

public void show(Node node){
  if(!isShowing()){
    if(node.getScene() == null || node.getScene().getWindow() == null)
      throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
    Window parent = node.getScene().getWindow();
    this.show(parent, parent.getX() + node.localToScene(0, 0).getX() +
             node.getScene().getX(),
      parent.getY() + node.localToScene(0, 0).getY() +
      node.getScene().getY() + ((Region)node).getHeight());
    ((JFXAutoCompletePopupSkin<T>)getSkin()).animate();
  }
}

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

/**
 * show the popup according to the specified position with a certain offset
 *
 * @param vAlign      can be TOP/BOTTOM
 * @param hAlign      can be LEFT/RIGHT
 * @param initOffsetX on the x axis
 * @param initOffsetY on the y axis
 */
public void show(Node node, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) {
  if (!isShowing()) {
    if (node.getScene() == null || node.getScene().getWindow() == null) {
      throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
    }
    Window parent = node.getScene().getWindow();
    final Point2D origin = node.localToScene(0, 0);
    final double anchorX = parent.getX() + origin.getX()
      + node.getScene().getX() + (hAlign == PopupHPosition.RIGHT ? ((Region) node).getWidth() : 0);
    final double anchorY = parent.getY() + origin.getY()
      + node.getScene()
         .getY() + (vAlign == PopupVPosition.BOTTOM ? ((Region) node).getHeight() : 0);
    this.show(parent, anchorX, anchorY);
    ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY);
    Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate());
  }
}

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

public void show(Node node) {
    if (text == null) {
      text = (Text) node.lookup(".text");
    }
    node = text;
    if (!isShowing()) {
      if (node.getScene() == null || node.getScene().getWindow() == null) {
        throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
      }
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
      ((JFXAutoCompletePopupSkin<T>) getSkin()).animate();
    } else {
      // if already showing update location if needed
      Window parent = node.getScene().getWindow();
      this.show(parent, parent.getX() +
               node.localToScene(0, 0).getX() +
               node.getScene().getX(),
        parent.getY() + node.localToScene(0, 0).getY() +
        node.getScene().getY() + node.getLayoutBounds().getHeight() + shift);
    }
  }
}

代码示例来源:origin: torakiki/pdfsam

private Point2D getDisplayCoordiantes(Window owner, Scene scene) {
    Point2D nodeCoord = ValidableTextField.this.localToScene(0.0, ValidableTextField.this.getHeight());
    double anchorX = Math.round(owner.getX() + scene.getX() + nodeCoord.getX() + 2);
    double anchorY = Math.round(owner.getY() + scene.getY() + nodeCoord.getY() - 2);
    return new Point2D(anchorX, anchorY);
  }
}

代码示例来源:origin: torakiki/pdfsam

private void showPasswordFieldPopup() {
  Scene scene = this.getScene();
  if (scene != null) {
    Window owner = scene.getWindow();
    if (owner != null && owner.isShowing()) {
      Point2D nodeCoord = encryptionIndicator.localToScene(encryptionIndicator.getWidth() / 2,
          encryptionIndicator.getHeight() / 1.5);
      double anchorX = Math.round(owner.getX() + scene.getX() + nodeCoord.getX() + 2);
      double anchorY = Math.round(owner.getY() + scene.getY() + nodeCoord.getY() + 2);
      passwordPopup.showFor(this, descriptor, anchorX, anchorY);
    }
  }
}

代码示例来源:origin: torakiki/pdfsam

@EventListener
public void showPasswordFieldPopup(ShowPasswordFieldPopupRequest request) {
  Scene scene = this.getScene();
  if (scene != null) {
    Window owner = scene.getWindow();
    if (owner != null && owner.isShowing()) {
      Point2D nodeCoord = request.getRequestingNode().localToScene(request.getRequestingNode().getWidth() / 2,
          request.getRequestingNode().getHeight() / 1.5);
      double anchorX = Math.round(owner.getX() + scene.getX() + nodeCoord.getX() + 2);
      double anchorY = Math.round(owner.getY() + scene.getY() + nodeCoord.getY() + 2);
      passwordPopup.showFor(this, request.getPdfDescriptor(), anchorX, anchorY);
    }
  }
}

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

import org.controlsfx.control.PopOver;
import org.controlsfx.control.PopOver.ArrowLocation;

private PopOver item;

final Scene scene = addItemButton.getScene();

final Point2D windowCoord = new Point2D(scene.getWindow()
    .getX(), scene.getWindow().getY());

final Point2D sceneCoord = new Point2D(scene.getX(), scene.
        getY());

final Point2D nodeCoord = addItemButton.localToScene(0.0,
            0.0);
final double clickX = Math.round(windowCoord.getX()
  + sceneCoord.getY() + nodeCoord.getX());

final double clickY = Math.round(windowCoord.getY()
    + sceneCoord.getY() + nodeCoord.getY());
item.setContentNode(addItemScreen);
item.setArrowLocation(ArrowLocation.BOTTOM_LEFT);
item.setCornerRadius(4);                            
item.setDetachedTitle("Add New Item");
item.show(addItemButton.getParent(), clickX, clickY);

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

private void updateY() {
  Window stage = getOwner();
  setY(stage.getY() + stage.getScene().getY());
}

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

/**
*
* @param node
* @return The Y scene coordinate of the node.
*/
static public double sceneY(Node node) {
  return node.localToScene(node.getBoundsInLocal()).getMinY() + node.getScene().getY();
}

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

/**
 *
 * @param node
 * @return The Y screen coordinate of the node.
 */
static public double screenY(Node node) {
  return node.localToScene(node.getBoundsInLocal()).getMinY()
      + node.getScene().getY() + node.getScene().getWindow().getY();
}

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

/**
 *
 * @param node
 * @return The Y screen coordinate of the node.
 */
static public double screenY(Node node) {
  return node.localToScene(node.getBoundsInLocal()).getMinY() + node.getScene().getY() + node.getScene().getWindow().getY();
}

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

@Override
public Point2D getScenePosition() {
  Scene scene;
  if(source instanceof Node) {
    scene = ((Node) source).getScene();
  } else if(source instanceof Scene) {
    scene = (Scene) source;
  } else {
    return null;
  }
  return screenPos.subtract(
      scene.getX() + scene.getWindow().getX(),
      scene.getY() + scene.getWindow().getY());
}

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

@Override
public Point2D getScenePosition() {
  Scene scene;
  if(source instanceof Node) {
    scene = ((Node) source).getScene();
  } else if(source instanceof Scene) {
    scene = (Scene) source;
  } else {
    return null;
  }
  return screenPos.subtract(
      scene.getX() + scene.getWindow().getX(),
      scene.getY() + scene.getWindow().getY());
}

代码示例来源:origin: org.loadui/testFx

private static Bounds sceneBoundsToScreenBounds( Bounds sceneBounds, Scene scene )
{
  Window window = targetWindow( scene.getWindow() );
  BoundingBox b = new BoundingBox( window.getX() + scene.getX() + sceneBounds.getMinX(), window.getY() + scene.getY()
      + sceneBounds.getMinY(), sceneBounds.getWidth(), sceneBounds.getHeight() );
  return b;
}

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

public void show(Node node){
  if(!isShowing()){
    if(node.getScene() == null || node.getScene().getWindow() == null)
      throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
    Window parent = node.getScene().getWindow();
    this.show(parent, parent.getX() + node.localToScene(0, 0).getX() +
             node.getScene().getX(),
      parent.getY() + node.localToScene(0, 0).getY() +
      node.getScene().getY() + ((Region)node).getHeight());
    ((JFXAutoCompletePopupSkin<T>)getSkin()).animate();
  }
}

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

/**
 * Show this popup right below the given Node
 * 
 * @param node
 */
public void show(Node node) {
 if (node.getScene() == null || node.getScene().getWindow() == null) {
  throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
 } // $NON-NLS-1$
 if (isShowing()) {
  return;
 }
 final Window parent = node.getScene().getWindow();
 this.show(parent, parent.getX() + node.localToScene(0, 0).getX() + node.getScene().getX(), parent.getY() + node.localToScene(0, 0).getY() + node.getScene().getY() + control.getHeight());
}

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

/**
 * Show this popup right below the given Node
 * @param node
 */
public void show(Node node){
  if(node.getScene() == null || node.getScene().getWindow() == null)
    throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window."); //$NON-NLS-1$
  if(isShowing()){
    return;
  }
  
  Window parent = node.getScene().getWindow();
  this.show(
      parent,
      parent.getX() + node.localToScene(0, 0).getX() +
      node.getScene().getX(),
      parent.getY() + node.localToScene(0, 0).getY() +
      node.getScene().getY() + TITLE_HEIGHT);
}

相关文章