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

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

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

Label.prefHeight介绍

暂无

代码示例

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

private double computeErrorHeight(double errorContainerWidth) {
  return errorLabel.prefHeight(errorContainerWidth)
      + snappedBottomInset()
      + snappedTopInset();
}

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

@Override
protected double computePrefHeight(double width) {
  double minHeight = snapSize(getSkinnable().getTabMinHeight());
  double maxHeight = snapSize(getSkinnable().getTabMaxHeight());
  double paddingTop = snappedTopInset();
  double paddingBottom = snappedBottomInset();
  double tmpPrefHeight = snapSize(tabLabel.prefHeight(width));
  if (tmpPrefHeight > maxHeight) {
    tmpPrefHeight = maxHeight;
  } else if (tmpPrefHeight < minHeight) {
    tmpPrefHeight = minHeight;
  }
  tmpPrefHeight += paddingTop + paddingBottom;
  return tmpPrefHeight;
}

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

@SuppressWarnings("MethodDoesntCallSuperMethod")
 @Override
 protected double computePrefHeight(double width) {
  return label.prefHeight(width) + 6;
 }
}

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

@Override protected double computePrefHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
  return topInset + Math.max(thumb.prefHeight(-1), label.prefHeight(-1)) + bottomInset;
}

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

@Override protected double computeMinHeight(double width, double topInset, double rightInset, double bottomInset, double leftInset) {
  return topInset + Math.max(thumb.prefHeight(-1), label.prefHeight(-1)) + bottomInset;
}

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

private double computeErrorHeight(double errorContainerWidth) {
  return errorLabel.prefHeight(errorContainerWidth)
      + snappedBottomInset()
      + snappedTopInset();
}

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

final double labelHeight = titleLabel.prefHeight(-1);
final double labelWidth = titleLabel.prefWidth(labelHeight) + TITLE_PADDING;
titleLabel.resize(labelWidth, labelHeight);

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

@Override
protected double computePrefHeight(double width) {
  double minHeight = snapSize(getSkinnable().getTabMinHeight());
  double maxHeight = snapSize(getSkinnable().getTabMaxHeight());
  double paddingTop = snappedTopInset();
  double paddingBottom = snappedBottomInset();
  double tmpPrefHeight = snapSize(tabLabel.prefHeight(width));
  if (tmpPrefHeight > maxHeight) {
    tmpPrefHeight = maxHeight;
  } else if (tmpPrefHeight < minHeight) {
    tmpPrefHeight = minHeight;
  }
  tmpPrefHeight += paddingTop + paddingBottom;
  return tmpPrefHeight;
}

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

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

@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
  final double contentPrefHeight = content.prefHeight(contentWidth);
  
  // we calculate the pref width of the expand/collapse button. We will
  // ensure that the button does not get smaller than this.
  final double toggleButtonPrefWidth = expandCollapseButton.prefWidth(-1);
  expandCollapseButton.setMinWidth(toggleButtonPrefWidth);
  // All remaining width goes to the info label
  final Insets infoPanelPadding = infoPanel.getPadding();
  final double infoLabelWidth = snapSize(contentWidth - toggleButtonPrefWidth - 
      infoPanelPadding.getLeft() - infoPanelPadding.getRight());
  // we then can work out the necessary height for the info panel, based on
  // whether it is expanded or not, and given the current state of the animation.
  final double prefInfoPanelHeight = (snapSize(infoLabel.prefHeight(infoLabelWidth)) +
      snapSpace(infoPanel.getPadding().getTop()) +
      snapSpace(infoPanel.getPadding().getBottom())) *
      transition.get();
  infoLabel.setMaxWidth(infoLabelWidth);
  infoLabel.setMaxHeight(prefInfoPanelHeight);
  // position the imageView
  layoutInArea(content, contentX, contentY,
              contentWidth, contentHeight, -1, HPos.CENTER, VPos.TOP);
  
  // position the infoPanel (the HBox consisting of the Label and ToggleButton)
  layoutInArea(infoPanel, contentX, snapPosition(contentPrefHeight - prefInfoPanelHeight),
              contentWidth, prefInfoPanelHeight, 0, HPos.CENTER, VPos.BOTTOM);
}

相关文章