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

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

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

Window.setX介绍

暂无

代码示例

代码示例来源:origin: com.miglayout/miglayout-javafx

/** Checks the parent window/popup if its size is within parameters as set by the LC.
 */
private void adjustWindowSize()
{
  BoundSize wBounds = layoutConstraints.getPackWidth();
  BoundSize hBounds = layoutConstraints.getPackHeight();
  Scene scene = getScene();
  Window window = scene != null ? scene.getWindow() : null;
  if (window == null || wBounds == BoundSize.NULL_SIZE && hBounds == BoundSize.NULL_SIZE)
    return;
  Parent root = scene.getRoot();
  double winWidth = window.getWidth();
  double winHeight = window.getHeight();
  double prefWidth = root.prefWidth(-1);
  double prefHeight = root.prefHeight(-1);
  FXContainerWrapper container = new FXContainerWrapper(root);
  double horIns = winWidth - scene.getWidth();
  double verIns = winHeight - scene.getHeight();
  double targetW = constrain(container, winWidth, prefWidth, wBounds) + horIns;
  double targetH = constrain(container, winHeight, prefHeight, hBounds) + verIns;
  double x = window.getX() - ((targetW - winWidth) * (1 - layoutConstraints.getPackWidthAlign()));
  double y = window.getY() - ((targetH - winHeight) * (1 - layoutConstraints.getPackHeightAlign()));
  window.setX(x);
  window.setY(y);
  window.setWidth(targetW);
  window.setHeight(targetH);
}

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

window.setX(window.getX() + deltaX);
window.setY(window.getY() + deltaY);

相关文章