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

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

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

Label.setPrefWidth介绍

暂无

代码示例

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

sizingRoot.layout();
sizeLabel.setMinWidth(25);
sizeLabel.setPrefWidth(sizeCalculator.getWidth());
sizeLabel.setAlignment(Pos.BASELINE_RIGHT);

代码示例来源:origin: torakiki/pdfsam

Label labelDate = new Label(FORMATTER.format(data.getDate()),
    MaterialDesignIconFactory.get().createIcon(MaterialDesignIcon.CLOCK));
labelDate.setPrefWidth(Integer.MAX_VALUE);
HBox.setHgrow(labelDate, Priority.ALWAYS);
HBox bottom = new HBox(labelDate);

代码示例来源:origin: torakiki/pdfsam

public NewsPanel() {
  getStyleClass().add("news-panel");
  getStyleClass().addAll(Style.CONTAINER.css());
  Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
  closeButton.getStyleClass().addAll("close-button");
  closeButton.setOnAction(e -> eventStudio().broadcast(HideNewsPanelRequest.INSTANCE));
  Label titleLabel = new Label(DefaultI18nContext.getInstance().i18n("What's new"));
  titleLabel.setPrefWidth(Integer.MAX_VALUE);
  titleLabel.getStyleClass().add("news-panel-title");
  StackPane top = new StackPane(titleLabel, closeButton);
  top.setAlignment(Pos.TOP_RIGHT);
  scroll.getStyleClass().add("scrollable-news");
  scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
  scroll.setFitToHeight(true);
  scroll.setFitToWidth(true);
  getChildren().addAll(top, scroll);
  eventStudio().addAnnotatedListeners(this);
}

代码示例来源:origin: torakiki/pdfsam

Notification(String title, Node content) {
  requireNotNull(content, "Notification content cannot be blank");
  getStyleClass().add("notification");
  getStyleClass().addAll(Style.CONTAINER.css());
  setId(UUID.randomUUID().toString());
  Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
  closeButton.getStyleClass().addAll("close-button");
  closeButton.setOnAction(e -> eventStudio().broadcast(new RemoveNotificationRequestEvent(getId())));
  Label titleLabel = new Label(title);
  titleLabel.setPrefWidth(Integer.MAX_VALUE);
  titleLabel.getStyleClass().add("notification-title");
  StackPane top = new StackPane(titleLabel, closeButton);
  top.setAlignment(Pos.TOP_RIGHT);
  getChildren().addAll(top, content);
  setOpacity(0);
  setOnMouseEntered(e -> {
    fade.stop();
    setOpacity(1);
  });
  setOnMouseClicked(e -> {
    setOnMouseEntered(null);
    setOnMouseExited(null);
    fade.stop();
    eventStudio().broadcast(new RemoveNotificationRequestEvent(getId()));
  });
  fade.setFromValue(1);
  fade.setToValue(0);
}

代码示例来源: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: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

this.nameProperty.setPrefWidth(Double.MAX_VALUE);
this.nameProperty.setAlignment(Pos.CENTER);

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

this.nameProperty.setPrefWidth(Double.MAX_VALUE);
this.nameProperty.setAlignment(Pos.CENTER);

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

@Override
protected void updateItem(RepositoryLocation<? extends Repository> item, boolean empty) {
  super.updateItem(item, empty);
  if (!empty) {
    ObservableList<RepositoryLocation<? extends Repository>> repositories = getListView().getItems();
    GridPane itemPane = new GridPane();
    Label indexLabel = new Label(String.valueOf(repositories.size() - repositories.indexOf(item)));
    indexLabel.setPrefWidth(50);
    Label repositoryLocationLabel = new Label(item.toDisplayString());
    itemPane.add(indexLabel, 0, 0);
    itemPane.add(repositoryLocationLabel, 1, 0);
    setGraphic(itemPane);
  } else {
    setGraphic(null);
  }
}

代码示例来源:origin: com.aquafx-project/aquafx

final Label label = new Label();
label.setText("progress: " + values[i]);
label.setPrefWidth(100d);

相关文章