javafx.scene.control.Button.prefWidth()方法的使用及代码示例

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

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

Button.prefWidth介绍

暂无

代码示例

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

@Override
protected double computePrefWidth(double height) {
  double minWidth = snapSize(getSkinnable().getTabMinWidth());
  double maxWidth = snapSize(getSkinnable().getTabMaxWidth());
  double paddingRight = snappedRightInset();
  double paddingLeft = snappedLeftInset();
  double tmpPrefWidth = snapSize(tabLabel.prefWidth(-1));
  if (showCloseButton()) {
    tmpPrefWidth += snapSize(closeButton.prefWidth(-1));
  }
  if (tmpPrefWidth > maxWidth) {
    tmpPrefWidth = maxWidth;
  } else if (tmpPrefWidth < minWidth) {
    tmpPrefWidth = minWidth;
  }
  tmpPrefWidth += paddingRight + paddingLeft;
  return tmpPrefWidth;
}

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

void layout() {
  double maxWidth = 0;
  for (Button b : this.buttons) {
    maxWidth = Math.max(maxWidth, b.prefWidth(-1));
  }
  for (Button b : this.buttons) {
    b.setPrefWidth(maxWidth);
  }
  // Point2D size = getInitialSize();
  // stage.setWidth(size.getX());
  // stage.setHeight(size.getY());
  // stage.sizeToScene();
}

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

@Override
protected double computePrefWidth(double height) {
  double minWidth = snapSize(getSkinnable().getTabMinWidth());
  double maxWidth = snapSize(getSkinnable().getTabMaxWidth());
  double paddingRight = snappedRightInset();
  double paddingLeft = snappedLeftInset();
  double tmpPrefWidth = snapSize(tabLabel.prefWidth(-1));
  if (showCloseButton()) {
    tmpPrefWidth += snapSize(closeButton.prefWidth(-1));
  }
  if (tmpPrefWidth > maxWidth) {
    tmpPrefWidth = maxWidth;
  } else if (tmpPrefWidth < minWidth) {
    tmpPrefWidth = minWidth;
  }
  tmpPrefWidth += paddingRight + paddingLeft;
  return tmpPrefWidth;
}

相关文章

微信公众号

最新文章

更多