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

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

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

Label.setMaxWidth介绍

暂无

代码示例

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

public JFXDefaultChip(JFXChipView<T> view, T item) {
    super(view, item);
    JFXButton closeButton = new JFXButton(null, new SVGGlyph());
    closeButton.getStyleClass().add("close-button");
    closeButton.setOnAction((event) -> view.getChips().remove(item));

    String tagString = null;
    if (getItem() instanceof String) {
      tagString = (String) getItem();
    } else {
      tagString = view.getConverter().toString(getItem());
    }
    Label label = new Label(tagString);
    label.setWrapText(true);
    root = new HBox(label, closeButton);
    getChildren().setAll(root);
    label.setMaxWidth(100);
  }
}

代码示例来源:origin: speedment/speedment

box.setMaxWidth(Double.MAX_VALUE);
bar.setMaxWidth(Double.MAX_VALUE);
message.setMaxWidth(Double.MAX_VALUE);
cancel.setMaxWidth(128);
VBox.setVgrow(message, Priority.ALWAYS);

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * {@inheritDoc}
 */
@Override
public Node getDisplayNode(List<IListFormValue> values) {
 final Label valueLabel = new Label();
 valueLabel.setWrapText(true);
 valueLabel.setMaxWidth(100);
 valueLabel.getStyleClass().add("ep-list-form-data-value");
 if (values != null && !values.isEmpty()) {
  valueLabel.setText(values.get(0).getDisplayedValue());
 }
 return valueLabel;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Dispaly current value
 */
protected void displayValue() {
 String currVal = getCurrentDisplayText();
 Label currValLabel = new Label();
 currentValuesPresenter.getChildren().clear();
 currentValuesPresenter.getChildren().add(currValLabel);
 if (StringUtils.isNotBlank(currVal)) {
  String[] t = currVal.split(File.separator);
  String val = t[t.length - 1];
  currValLabel.setText(val);
  currValLabel.setMaxWidth(100);
  currValLabel.setTooltip(new Tooltip(currVal));
 }
}

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

public LineInfo() {
  this.markerLabel = new Label();
  this.markerLabel.setPrefWidth(20);
  this.lineText = new Label();
  this.lineText.getStyleClass().add("line-ruler-text"); //$NON-NLS-1$
  this.lineText.setMaxWidth(Double.MAX_VALUE);
  this.lineText.setMaxHeight(Double.MAX_VALUE);
  this.lineText.setAlignment(Pos.CENTER_RIGHT);
  HBox.setHgrow(this.lineText, Priority.ALWAYS);
  getChildren().addAll(this.markerLabel, this.lineText);
}

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

public JFXDefaultChip(JFXChipView<T> view, T item) {
    super(view, item);
    JFXButton closeButton = new JFXButton(null, new SVGGlyph());
    closeButton.getStyleClass().add("close-button");
    closeButton.setOnAction((event) -> view.getChips().remove(item));

    String tagString = null;
    if (getItem() instanceof String) {
      tagString = (String) getItem();
    } else {
      tagString = view.getConverter().toString(getItem());
    }
    Label label = new Label(tagString);
    label.setWrapText(true);
    root = new HBox(label, closeButton);
    getChildren().setAll(root);
    label.setMaxWidth(100);
  }
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * @{inheritedDoc}
 */
@Override
public void build(IInputComponentWrapper inputComponentWrapper) {
 super.build(inputComponentWrapper);
 NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value");
 label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(inputComponentWrapper.getCurrentInternalValue()));
 if(AbstractApplicationRunner.isDesktop()) {
  // TODO HANDLE TOOLTIP
  label.setMaxWidth(400);
 }
 inputComponentWrapper.currentInternalValueProperty().addListener((ChangeListener<String>) (observable, oldValue, newValue) -> {
  label.setText(((StringConverter) inputComponentWrapper.getConverter()).toDisplay(newValue));
 });
}

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

messageLabel.setMaxWidth(Double.MAX_VALUE);
messageLabel.setPrefSize(420, 56);
messageLabel.setWrapText(true);

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

相关文章