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

x33g5p2x  于2022-01-30 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(197)

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

TextArea.textProperty介绍

暂无

代码示例

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

fieldName.textProperty().addListener((ob, o, n) -> recalculateFields.run());
fieldSchema.textProperty().addListener((ob, o, n) -> recalculateFields.run());
areaConnectionUrl.textProperty().addListener((ob, o, n) -> recalculateFields.run());

代码示例来源:origin: com.powsybl/powsybl-gse-afs-ext-base

private javafx.scene.Node createListStringComponent(Parameter parameter) {
  TextArea textArea = new TextArea(((List<String>) parameter.getDefaultValue()).stream().collect(Collectors.joining(System.lineSeparator())));
  textArea.setPrefColumnCount(20);
  textArea.setPrefRowCount(5);
  textArea.textProperty().addListener((observable, oldValue, newValue) -> parametersValue.put(parameter.getName(), newValue.replace(System.lineSeparator(), ",")));
  return new VBox(5, new Label(parameter.getDescription()), textArea);
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

@Override
  public Node createValueVisualisation() {
    TextArea textArea = new TextArea();
    textArea.textProperty().bindBidirectional(observableAttributeValue);
    textArea.disableProperty().bind(readOnly);
    return textArea;
  }
}

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

/**
 * Creates the expandable content component of the {@link ErrorDialog}
 *
 * @return The expandable content component of the {@link ErrorDialog}
 */
private VBox createExpandableContent() {
  final Label label = new Label(tr("Stack trace:"));
  final TextArea textArea = new TextArea();
  textArea.setEditable(false);
  textArea.textProperty().bind(Bindings.createStringBinding(
      () -> Optional.ofNullable(getException()).map(ExceptionUtils::getFullStackTrace).orElse(null),
      exception));
  VBox.setVgrow(textArea, Priority.ALWAYS);
  final VBox container = new VBox(label, textArea);
  container.setFillWidth(true);
  return container;
}

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Makes the character counter colorful depending on the current amount typed relative to the maximum Twitter
 * allows.
 */
private void enableTweetLengthCheck() {
  tweetTextArea.textProperty().addListener((observable, oldValue, newValue) -> {
    final Color color = Match(newValue.length()).of(
        Case($(tweetLen -> tweetLen < 250), GREEN),
        Case($(tweetLen -> tweetLen >= 250 && tweetLen < 280), ORANGE),
        Case($(tweetLen -> tweetLen > 280), RED),
        Case($(tweetLen -> tweetLen == 280), BLUE)
    );
    Platform.runLater(() -> {
      charactersLeft.setText(Integer.toString(newValue.length()));
      charactersLeft.setTextFill(color);
    });
  });
}

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

/**
 * @{inheritedDoc}
 */
@Override
public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) {
 super.buildFrom(controller, configuration);
 textArea.setPrefRowCount(2);
 // prompt
 prompt.ifPresent(e -> {
  final String val = controller.getLocalised(prompt.get());
  textArea.setPromptText(val);
 });
 // process wizardConfiguration
 final Optional<VLViewComponentXML> displayConfig = configuration.getComponentById(DISPLAY_CONFIG);
 displayConfig.ifPresent(d -> {
  d.booleanPropertyValueOf(XMLConstants.READ_ONLY).ifPresent(e -> {
   textArea.setDisable(e);
  });
  d.intPropertyValueOf(XMLConstants.COUNTER).ifPresent(e -> {
   if (e > 0) {
    // !! not for validation, for counter
    // textArea.setMaxLength(e);
   }
  });
 });
 textArea.setText(owner.getCurrentInternalValue());
 Bindings.bindBidirectional(textArea.textProperty(), owner.currentInternalValueProperty(), owner.getConverter());
}

代码示例来源:origin: ssaring/sportstracker

@Override
protected void setupDialogControls() {
  // setup binding between view model and the UI controls
  dpDate.valueProperty().bindBidirectional(noteViewModel.date);
  // use text formatter for time values => makes sure that the value is also valid
  final TextFormatter<LocalTime> timeTextFormatter = new TextFormatter<>(new TimeToStringConverter());
  timeTextFormatter.valueProperty().bindBidirectional(noteViewModel.time);
  tfTime.setTextFormatter(timeTextFormatter);
  taText.textProperty().bindBidirectional(noteViewModel.comment);
  FxWorkarounds.fixDatePickerTextEntry(dpDate);
  // setup validation of the UI controls
  // => due to a ControlsFX bug the validation setup must be executed after the dialog has been shown
  // (see https://bitbucket.org/controlsfx/controlsfx/issues/539/multiple-dialog-fields-with-validation )
  Platform.runLater(() -> {
    validationSupport.registerValidator(dpDate, //
        Validator.createEmptyValidator(context.getResources().getString("st.dlg.note.error.date")));
    validationSupport.registerValidator(tfTime, //
        Validator.createEmptyValidator(context.getResources().getString("st.dlg.note.error.time")));
    validationSupport.registerValidator(taText, //
        Validator.createEmptyValidator(context.getResources().getString("st.dlg.note.error.no_text")));
  });
}

代码示例来源:origin: ssaring/sportstracker

@Override
protected void setupDialogControls() {
  laWeightUnit.setText(context.getFormatUtils().getWeightUnitName());
  // setup binding between view model and the UI controls
  dpDate.valueProperty().bindBidirectional(weightViewModel.date);
  // use text formatter for time values => makes sure that the value is also valid
  final TextFormatter<LocalTime> timeTextFormatter = new TextFormatter<>(new TimeToStringConverter());
  timeTextFormatter.valueProperty().bindBidirectional(weightViewModel.time);
  tfTime.setTextFormatter(timeTextFormatter);
  tfValue.textProperty().bindBidirectional(weightViewModel.value, new NumberStringConverter());
  taComment.textProperty().bindBidirectional(weightViewModel.comment);
  FxWorkarounds.fixDatePickerTextEntry(dpDate);
  // setup validation of the UI controls
  // => due to a ControlsFX bug the validation setup must be executed after the dialog has been shown
  // (see https://bitbucket.org/controlsfx/controlsfx/issues/539/multiple-dialog-fields-with-validation )
  Platform.runLater(() -> {
    validationSupport.registerValidator(dpDate,
        Validator.createEmptyValidator(context.getResources().getString("st.dlg.weight.error.date")));
    validationSupport.registerValidator(tfTime, //
        Validator.createEmptyValidator(context.getResources().getString("st.dlg.weight.error.time")));
    validationSupport.registerValidator(tfValue, true, (Control control, String newValue) -> ValidationResult
        .fromErrorIf(tfValue, context.getResources().getString("st.dlg.weight.error.weight"),
            !ValidationUtils.isValueDoubleBetween(newValue, 0.1d, 1000)));
  });
}

代码示例来源:origin: com.dlsc.formsfx/formsfx-core

/**
 * {@inheritDoc}
 */
@Override
public void setupBindings() {
  super.setupBindings();
  editableArea.visibleProperty().bind(Bindings.and(field.editableProperty(),
                          field.multilineProperty()));
  editableField.visibleProperty().bind(Bindings.and(field.editableProperty(),
                          field.multilineProperty().not()));
  readOnlyLabel.visibleProperty().bind(field.editableProperty().not());
  editableField.textProperty().bindBidirectional(field.userInputProperty());
  editableArea.textProperty().bindBidirectional(field.userInputProperty());
  readOnlyLabel.textProperty().bind(field.userInputProperty());
  fieldLabel.textProperty().bind(field.labelProperty());
  editableField.promptTextProperty().bind(field.placeholderProperty());
  editableArea.promptTextProperty().bind(field.placeholderProperty());
  editableArea.managedProperty().bind(editableArea.visibleProperty());
  editableField.managedProperty().bind(editableField.visibleProperty());
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

logConfig.textProperty().addListener(new ChangeListener<String>() {
  @Override
  public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {

代码示例来源:origin: ssaring/sportstracker

/**
 * Setup of the binding between view model and the UI controls.
 */
private void setupBinding() {
  dpDate.valueProperty().bindBidirectional(exerciseViewModel.date);
  // use comment formatter for time values => makes sure that the value is also valid
  final TextFormatter<LocalTime> timeTextFormatter = new TextFormatter<>(new TimeToStringConverter());
  timeTextFormatter.valueProperty().bindBidirectional(exerciseViewModel.time);
  tfTime.setTextFormatter(timeTextFormatter);
  cbSportType.valueProperty().bindBidirectional(exerciseViewModel.sportType);
  cbSportSubtype.valueProperty().bindBidirectional(exerciseViewModel.sportSubType);
  cbIntensity.valueProperty().bindBidirectional(exerciseViewModel.intensity);
  tfDistance.textProperty().bindBidirectional(exerciseViewModel.distance, new NumberStringConverter());
  tfAvgSpeed.textProperty().bindBidirectional(exerciseViewModel.avgSpeed);
  tfDuration.textProperty().bindBidirectional(exerciseViewModel.duration, new TimeInSecondsToStringConverter());
  tfAscent.textProperty().bindBidirectional(exerciseViewModel.ascent, new NumberStringConverter());
  tfDescent.textProperty().bindBidirectional(exerciseViewModel.descent, new NumberStringConverter());
  tfAvgHeartrate.textProperty().bindBidirectional(exerciseViewModel.avgHeartRate, new NumberStringConverter());
  tfCalories.textProperty().bindBidirectional(exerciseViewModel.calories, new NumberStringConverter());
  cbEquipment.valueProperty().bindBidirectional(exerciseViewModel.equipment);
  tfHrmFile.textProperty().bindBidirectional(exerciseViewModel.hrmFile);
  taComment.textProperty().bindBidirectional(exerciseViewModel.comment);
}

相关文章