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

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

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

Label.setText介绍

暂无

代码示例

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

public void setToast(String toast) {
  this.toast.setText(toast);
}

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

@Override
public void initialize(URL location, ResourceBundle resources) {
  title.setTextFill(Color.web("#45a6fc")); // TODO Use styleClass instead
  header.setText("Component Explorer");
  final RootItem root = new RootItem(speedment);
  root.getChildren().addAll(components());
  tree.setRoot(root);
  close.setOnAction(newCloseHandler());
}

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

@Override
  public void initialize(URL location, ResourceBundle resources) {

    brand.logoLarge().map(Image::new).ifPresent(titleImage::setImage);
    license.setText(license.getText().replace("{title}", infoComponent.getTitle()));
    version.setText(infoComponent.getImplementationVersion());
    external.setText(infoComponent.getLicenseName());
    
    close.setOnAction(newCloseHandler());
  }
}

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

protected StackPane createHeaderPane(LocalTime time, boolean _24HourView) {
  int hour = time.getHour();
  selectedHourLabel.setText(String.valueOf(hour % (_24HourView ? 24 : 12) == 0 ? (_24HourView ? 0 : 12) : hour % (_24HourView ? 24 : 12)));
  selectedHourLabel.getStyleClass().add(SPINNER_LABEL);
  selectedHourLabel.setTextFill(Color.WHITE);
  timeLabel.set(selectedHourLabel);
  selectedMinLabel.setText(String.valueOf(unitConverter.toString(time.getMinute())));
  selectedMinLabel.getStyleClass().add(SPINNER_LABEL);
  selectedMinLabel.setTextFill(fadedColor);

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

private void goToTime(LocalTime time) {
  if (time != null) {
    int hour = time.getHour();
    selectedHourLabel.setText(Integer.toString(hour % (is24HourView ? 24 : 12) == 0 ?
      (is24HourView ? 0 : 12) : hour % (is24HourView ? 24 : 12)));
    selectedMinLabel.setText(unitConverter.toString(time.getMinute()));
    if (!is24HourView) {
      period.set(hour < 12 ? "AM" : "PM");
    }
    minsPointerRotate.setAngle(180 + (time.getMinute() + 45) % 60 * Math.toDegrees(2 * Math.PI / 60));
    hoursPointerRotate.setAngle(180 + Math.toDegrees(2 * (hour - 3) * Math.PI / 12));
    _24HourHoursPointerRotate.setAngle(180 + Math.toDegrees(2 * (hour - 3) * Math.PI / 12));
  }
}

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

private void updateColor() {
  final ColorPicker colorPicker = (ColorPicker) getSkinnable();
  Color color = colorPicker.getValue();
  // update picker box color
  Color circleColor = color == null ? Color.WHITE : color;
  Circle colorCircle = new Circle();
  colorCircle.setFill(circleColor);
  colorCircle.setLayoutX(colorBox.getWidth() / 4);
  colorCircle.setLayoutY(colorBox.getHeight() / 2);
  colorBox.getChildren().add(colorCircle);
  Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240),
    new KeyValue(colorCircle.radiusProperty(),
      200,
      Interpolator.EASE_BOTH)));
  animateColor.setOnFinished((finish) -> {
    JFXNodeUtils.updateBackground(colorBox.getBackground(), colorBox, colorCircle.getFill());
    colorBox.getChildren().remove(colorCircle);
  });
  animateColor.play();
  // update label color
  displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf(
    "rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
  if (colorLabelVisible.get()) {
    displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
  } else {
    displayNode.setText("");
  }
}

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

/**
 * Initializes the controller class.
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
  notification.setText(message);
  notification.setGraphic(icon.view());
  notification.getStyleClass().add(palette.name().toLowerCase());
}

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

protected void updateMonthYearPane() {
  // update date labels
  YearMonth yearMonth = selectedYearMonth.get();
  LocalDate value = datePicker.getValue();
  value = value == null ? LocalDate.now() : value;
  selectedDateLabel.setText(DateTimeFormatter.ofPattern("EEE, MMM dd").format(value));
  selectedYearLabel.setText(formatYear(yearMonth));
  monthYearLabel.setText(formatMonth(yearMonth) + " " + formatYear(yearMonth));
  Chronology chrono = datePicker.getChronology();
  LocalDate firstDayOfMonth = yearMonth.atDay(1);
  backMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, -1, DAYS));
  forwardMonthButton.setDisable(!isValidDate(chrono, firstDayOfMonth, +1, MONTHS));
}

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

private void hideError() {
  // clear error label text
  errorLabel.setText(null);
  // clear error icon
  errorIcon.getChildren().clear();
  // reset the height of the text field
  // hide error container
  setVisible(false);
}

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

private RootItem(Speedment speedment) {
    super(
      infoComponent.getTitle() + " (0x" + Integer.toHexString(System.identityHashCode(speedment)) + ")"
    );
    setExpanded(true);
    setGraphic(SpeedmentIcon.BOX.view());
    title.setText(infoComponent.getTitle());
  }
}

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

@Override
public Label createNode() {
  final Label label = new Label("");
  events.on(BeforeGenerate.class, bg -> runLater(() -> label.setText("Generating...")));
  events.on(FileGenerated.class, fg -> runLater(() -> label.setText(fg.meta().getModel().getName())));
  events.on(AfterGenerate.class, ag -> runLater(() -> label.setText("")));
  return label;
}

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

private void refreshView() {
  if (glyph.getValue() == null) {
    idLabel.setText("");
    nameLabel.setText("");
    return;
  }
  sizeSlider.valueProperty().addListener(observable -> glyph.get().setSize(sizeSlider.getValue()));
  idLabel.setText(String.format("%04d", glyph.get().getGlyphId()));
  nameLabel.setText(glyph.get().getName());
  glyph.get().setFill(colorPicker.getValue());
  glyph.get().fillProperty().bind(colorPicker.valueProperty());
  centeredGlyph.getChildren().setAll(glyph.get());
}

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

updateInnerUI();
} else if ("TEXT".equals(p)) {
  tabLabel.setText(tab.getText());
} else if ("GRAPHIC".equals(p)) {
  tabLabel.setGraphic(tab.getGraphic());

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

private void showError(ValidatorBase validator) {
  // set text in error label
  errorLabel.setText(validator.getMessage());
  // show error icon
  Node icon = validator.getIcon();
  errorIcon.getChildren().clear();
  if (icon != null) {
    errorIcon.getChildren().setAll(icon);
    StackPane.setAlignment(icon, Pos.CENTER_RIGHT);
  }
  setVisible(true);
}

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

private void showError(ValidatorBase validator) {
  // set text in error label
  errorLabel.setText(validator.getMessage());
  // show error icon
  Node awsomeIcon = validator.getIcon();
  errorIcon.getChildren().clear();
  if (awsomeIcon != null) {
    errorIcon.getChildren().add(awsomeIcon);
    StackPane.setAlignment(awsomeIcon, Pos.TOP_RIGHT);
  }
  // init only once, to fix the text pane from resizing
  if (initYlayout == -1) {
    initYlayout = getBoundsInParent().getMinY();
    initHeight = getHeight();
    currentFieldHeight = initHeight;
  }
  errorContainer.setVisible(true);
  errorShown = true;
}

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

toast.getStyleClass().add("jfx-snackbar-toast");
toast.setWrapText(true);
toast.setText(message);
StackPane toastContainer = new StackPane(toast);
toastContainer.setPadding(new Insets(20));

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

if (displayNode != null) {
  if (colorLabelVisible.get()) {
    displayNode.setText(JFXNodeUtils.colorToHex(getSkinnable().getValue()));
  } else {
    displayNode.setText("");

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

private void hideError() {
  if (heightChanged) {
    new Timeline(new KeyFrame(Duration.millis(160),
      new KeyValue(translateYProperty(), 0, Interpolator.EASE_BOTH))).play();
    // reset the height of text field
    new Timeline(new KeyFrame(Duration.millis(160),
      new KeyValue(minHeightProperty(), initHeight, Interpolator.EASE_BOTH))).play();
    heightChanged = false;
  }
  // clear error label text
  errorLabel.setText(null);
  oldErrorLabelHeight = errorLabelInitHeight;
  // clear error icon
  errorIcon.getChildren().clear();
  // reset the height of the text field
  currentFieldHeight = initHeight;
  // hide error container
  errorContainer.setVisible(false);
  errorShown = false;
}

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

timeValue = (index + 45) % 60;
  timeLabel.get().setText(unit.get() == TimeUnit.MINUTES ? unitConverter.toString(timeValue) : Integer.toString(timeValue));
  updateValue();
};

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

dialog.close();
} else {
  message.setText(msg);
  bar.setProgress(prg);

相关文章