javafx.stage.Window.getY()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(123)

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

Window.getY介绍

暂无

代码示例

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

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

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

public void show(Window window, double x, double y, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) {
  if (!isShowing()) {
    if (window == null) {
      throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
    }
    Window parent = window;
    final double anchorX = parent.getX() + x + initOffsetX;
    final double anchorY = parent.getY() + y + initOffsetY;
    this.show(parent, anchorX, anchorY);
    ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY);
    Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate());
  }
}

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

private void fixPosition() {
  Window w = dialog.getOwner();
  Screen s = com.sun.javafx.util.Utils.getScreen(w);
  Rectangle2D sb = s.getBounds();
  double xR = w.getX() + w.getWidth();
  double xL = w.getX() - dialog.getWidth();
  double x;
  double y;
  if (sb.getMaxX() >= xR + dialog.getWidth()) {
    x = xR;
  } else if (sb.getMinX() <= xL) {
    x = xL;
  } else {
    x = Math.max(sb.getMinX(), sb.getMaxX() - dialog.getWidth());
  }
  y = Math.max(sb.getMinY(), Math.min(sb.getMaxY() - dialog.getHeight(), w.getY()));
  dialog.setX(x);
  dialog.setY(y);
}

代码示例来源: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: org.jfxtras/jfxtras-common

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

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

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

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

public void show(Window window, double x, double y, PopupVPosition vAlign, PopupHPosition hAlign, double initOffsetX, double initOffsetY) {
  if (!isShowing()) {
    if (window == null) {
      throw new IllegalStateException("Can not show popup. The node must be attached to a scene/window.");
    }
    Window parent = window;
    final double anchorX = parent.getX() + x + initOffsetX;
    final double anchorY = parent.getY() + y + initOffsetY;
    this.show(parent, anchorX, anchorY);
    ((JFXPopupSkin) getSkin()).reset(vAlign, hAlign, initOffsetX, initOffsetY);
    Platform.runLater(() -> ((JFXPopupSkin) getSkin()).animate());
  }
}

代码示例来源: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.netbeans.html/net.java.html.boot.fx

@Override
  public void handle(WindowEvent event) {
    Window window = (Window) event.getSource();
    prefs.putDouble("x", window.getX()); // NOI18N
    prefs.putDouble("y", window.getY()); // NOI18N
    prefs.putDouble("width", window.getWidth()); // NOI18N
    prefs.putDouble("height", window.getHeight()); // NOI18N
  }
};

代码示例来源: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());
}

相关文章