javafx.scene.layout.BorderPane.getWidth()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(125)

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

BorderPane.getWidth介绍

暂无

代码示例

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

@Override
  protected void layoutChildren() {
    super.layoutChildren();

    Insets pad = getPadding();
    double width = getWidth() * this.leftRightRatio;
    double height = getHeight() - (pad.getTop() + pad.getBottom());

    this.left.resizeRelocate(pad.getLeft(), pad.getTop(), width, height);
    this.right.resizeRelocate(getWidth() - pad.getRight() - width, pad.getTop(), width, height);

    this.top.resizeRelocate(this.left.getLayoutX() + this.left.getWidth(), this.left.getLayoutY(), getWidth() - width * 2, height / 2);
    this.bottom.resizeRelocate(this.left.getLayoutX() + this.left.getWidth(), this.top.getLayoutY() + this.top.getHeight(), getWidth() - width * 2, height / 2);
  }
}

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

@Override
  protected void layoutChildren() {
    super.layoutChildren();

    Insets pad = getPadding();
    double width = getWidth() * this.leftRightRatio;
    double height = getHeight() - (pad.getTop() + pad.getBottom());

    this.left.resizeRelocate(pad.getLeft(), pad.getTop(), width, height);
    this.right.resizeRelocate(getWidth() - pad.getRight() - width, pad.getTop(), width, height);

    this.top.resizeRelocate(this.left.getLayoutX() + this.left.getWidth(), this.left.getLayoutY(), getWidth() - width * 2, height / 2);
    this.bottom.resizeRelocate(this.left.getLayoutX() + this.left.getWidth(), this.top.getLayoutY() + this.top.getHeight(), getWidth() - width * 2, height / 2);
  }
}

代码示例来源:origin: org.netbeans.html/net.java.html.boot.fx

private void _resize(final double width, final double height) {
  Window window = container.getScene().getWindow();
  // size difference between root node and window depends on OS and Decorations
  double diffY = window.getHeight() - container.getHeight();
  double diffX = window.getWidth() - container.getWidth();
  webView.setMaxWidth(width);
  webView.setMaxHeight(height);
  webView.setMinWidth(width);
  webView.setMinHeight(height);
  javafx.geometry.Rectangle2D screenBounds = Screen.getPrimary().getBounds();
  double scaleX = screenBounds.getWidth() / ( width + diffX );
  double scaleY = screenBounds.getHeight() / ( height + diffY );
  // calculate scale factor if too big for device, the .1 adds some padding
  double scale = Math.min(Math.min(scaleX, scaleY), 1.1) - .1;
  webView.setScaleX(scale);
  webView.setScaleY(scale);
  container.getScene().setRoot(new Group());
  ((Stage)window).setScene(new Scene(container, width * scale, height * scale));
}

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

return root.getWidth() / 2;

代码示例来源:origin: PhoenicisOrg/phoenicis

.addListener((observable, oldValue, newValue) -> console.setPrefWidth(content.getWidth() * 0.94));

相关文章