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

x33g5p2x  于2022-01-23 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(113)

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

Label.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: com.cedarsoft.commons/javafx

@SuppressWarnings("MethodDoesntCallSuperMethod")
@Override
protected double computePrefWidth(double height) {
 return label.prefWidth(height) + 10;
}

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

@Override protected double computePrefWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
  return leftInset + label.prefWidth(-1) + 20 + thumbArea.prefWidth(-1) + rightInset;
}

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

@Override protected double computeMinWidth(double height, double topInset, double rightInset, double bottomInset, double leftInset) {
  return leftInset + label.prefWidth(-1) + thumbArea.prefWidth(-1) + rightInset;
}

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

final double labelWidth = titleLabel.prefWidth(labelHeight) + TITLE_PADDING;
titleLabel.resize(labelWidth, labelHeight);
titleLabel.relocate(TITLE_PADDING * 2, -labelHeight / 2.0 - 1);

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

代码示例来源:origin: com.cedarsoft.commons/javafx

@SuppressWarnings("MethodDoesntCallSuperMethod")
@Override
protected void layoutChildren() {
 double width = getWidth();
 double height = getHeight();
 double labelPrefWidth = label.prefWidth(height);
 double labelPrefHeight = label.prefHeight(width);
 rectangle.setX(0);
 rectangle.setY(0);
 rectangle.setWidth(labelPrefWidth + 10);
 rectangle.setHeight(labelPrefHeight + 6);
 label.resizeRelocate(5, 3, labelPrefWidth, labelPrefHeight);
 line.setStartX(width / 2.0);
 line.setEndX(line.getStartX());
 line.setStartY(rectangle.getHeight());
 line.setEndY(height);
}

相关文章