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

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

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

Label.textProperty介绍

暂无

代码示例

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

});
size.textProperty()
  .bind(Bindings.createStringBinding(() -> String.valueOf(treeView.getCurrentItemsCount()),
                    treeView.currentItemsCountProperty()));

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

minCircle.setTranslateX(selectionCircle.getRadius() - minCircle.getRadius());
minCircle.setVisible(time.getMinute() % 5 != 0);
selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> {
  if (Integer.parseInt(newVal) % 5 == 0) {
    minCircle.setVisible(false);
  selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> {
    if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) {
      label.setTextFill(Color.rgb(255, 255, 255, 0.87));

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

selectedHourLabel.textProperty().addListener((o, oldVal, newVal) -> {
  if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) {
    label.setTextFill(Color.rgb(255, 255, 255, 0.87));
  selectedHourLabel.textProperty().addListener((o, oldVal, newVal) -> {
    if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) {
      label.setTextFill(Color.rgb(255, 255, 255, 0.54));

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

public ToolbarTitledPane() {
  getStyleClass().add("tool-bar-title");
  // change the default
  setCollapsible(false);
  toolBar.setPadding(Insets.EMPTY);
  Label titleLabel = new Label("Title");
  titleLabel.textProperty().bind(title);
  titleLabel.getStyleClass().add("title-label");
  toolBar.getItems().add(titleLabel);
  setGraphic(toolBar);
  // should be an empty string, binding prevents to set it
  textProperty().bind(Val.constant(""));
  // The toolbar is too large for the title region and is not
  // centered unless we bind the height, like follows
  Val.wrap(toolBar.parentProperty())
    .values()
    .filter(Objects::nonNull)
    .subscribe(parent -> {
      // The title region is provided by the skin,
      // this is the only way to access it outside of css
      StackPane titleRegion = (StackPane) parent;
      toolBar.maxHeightProperty().unbind();
      toolBar.maxHeightProperty().bind(titleRegion.heightProperty());
      toolBar.minHeightProperty().unbind();
      toolBar.minHeightProperty().bind(titleRegion.heightProperty());
      toolBar.prefHeightProperty().unbind();
      toolBar.prefHeightProperty().bind(titleRegion.heightProperty());
    });
}

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

private void setupReadOnlyTableView() {
  setupCellValueFactory(firstNameColumn, Person::firstNameProperty);
  setupCellValueFactory(lastNameColumn, Person::lastNameProperty);
  setupCellValueFactory(ageColumn, p -> p.age.asObject());
  ObservableList<Person> dummyData = generateDummyData(100);
  treeTableView.setRoot(new RecursiveTreeItem<>(dummyData, RecursiveTreeObject::getChildren));
  treeTableView.setShowRoot(false);
  treeTableViewCount.textProperty()
           .bind(Bindings.createStringBinding(() -> PREFIX + treeTableView.getCurrentItemsCount() + POSTFIX,
                             treeTableView.currentItemsCountProperty()));
  treeTableViewAdd.disableProperty()
          .bind(Bindings.notEqual(-1, treeTableView.getSelectionModel().selectedIndexProperty()));
  treeTableViewRemove.disableProperty()
            .bind(Bindings.equal(-1, treeTableView.getSelectionModel().selectedIndexProperty()));
  treeTableViewAdd.setOnMouseClicked((e) -> {
    dummyData.add(createNewRandomPerson());
    final IntegerProperty currCountProp = treeTableView.currentItemsCountProperty();
    currCountProp.set(currCountProp.get() + 1);
  });
  treeTableViewRemove.setOnMouseClicked((e) -> {
    dummyData.remove(treeTableView.getSelectionModel().selectedItemProperty().get().getValue());
    final IntegerProperty currCountProp = treeTableView.currentItemsCountProperty();
    currCountProp.set(currCountProp.get() - 1);
  });
  searchField.textProperty().addListener(setupSearchField(treeTableView));
}

代码示例来源:origin: stackoverflow.com

import javafx.beans.binding.Bindings;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.stage.Stage;

public class StageTrackingController {
 @FXML private Label stageX;
 public void initialize() {}  
 public void initData(final Stage stage) {
  stageX.textProperty().bind(
   Bindings.format(
    "(%1$.2f, %2$.2f)", 
    stage.xProperty(), 
    stage.yProperty()
   )
  );
 }
}

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

details.addRow(3, new Label("Size"), sizeControl);
sizeLabel.textProperty().bind(sizeSlider.valueProperty().asString("%.0f"));

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

editableTreeTableView.setShowRoot(false);
editableTreeTableView.setEditable(true);
editableTreeTableViewCount.textProperty()
             .bind(Bindings.createStringBinding(() -> PREFIX + editableTreeTableView.getCurrentItemsCount() + POSTFIX,
                               editableTreeTableView.currentItemsCountProperty()));

代码示例来源:origin: stackoverflow.com

public class Stage2Controller {

  @FXML
  private Label lb ;

  private Model model ;

  public void setModel(Model model) {
    lb.textProperty().unbind();
    this.model = model ;
    lb.textProperty().bind(model.textProperty());
  }

  // ...
}

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

/**
   * @return the message property
   */
  public StringProperty titleMessageProperty() {
    return this.titleMessage.textProperty();
  }
}

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

/**
  * @{inheritedDoc}
  */
 @Override
 public SimpleStringProperty labelProperty() {
  return (SimpleStringProperty) mainLabel.textProperty();
 }
}

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

/**
 * @{inheritedDoc}
 */
@Override
public void addDisplayBinding(Label label) {
 super.addDisplayBinding(label);
 label.textProperty().bind(textField.textProperty());
}

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

/**
   * Creates a new {@link Label} object containing the title of the sidebar group
   *
   * @return The created label
   */
  private Label createTitleLabel() {
    Label titleLabel = new Label();
    titleLabel.getStyleClass().add("sidebarTitle");

    titleLabel.textProperty().bind(getControl().titleProperty());

    return titleLabel;
  }
}

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

private Label createLabel() {
  Label text = new Label();
  text.textProperty().bind(getSkinnable().textProperty());
  text.getStyleClass().add("masker-text"); //$NON-NLS-1$
  return text;
}

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

/**
   * Creates a label for the title of the list element
   *
   * @return A label with the title of the list element
   */
  private Label createTitle() {
    final Label titleLabel = new Label();

    titleLabel.getStyleClass().add("information");
    titleLabel.textProperty().bind(getControl().titleProperty());

    return titleLabel;
  }
}

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

/**
   * Creates a label for the title of the list element
   *
   * @return A label with the title of the list element
   */
  private Label createTitle() {
    final Label titleLabel = new Label();

    titleLabel.getStyleClass().add("information");
    titleLabel.textProperty().bind(getControl().titleProperty());

    return titleLabel;
  }
}

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

/**
 * {@inheritDoc}
 */
@Override
public void setupBindings() {
  super.setupBindings();
  fieldLabel.textProperty().bind(field.labelProperty());
  setupRadioButtonBindings();
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

public BaleAmountAlwaysVisible() {
  getStylesheets().add(this.getClass().getResource("icons.css").toExternalForm());
  amount = new SimpleStringProperty(this, "amount", "");
  final ImageView imageView = new ImageView(img);
  final Label text = new Label();
  text.getStyleClass().add("iconText");
  text.textProperty().bind(amount);
  imageView.layoutXProperty().bind(text.widthProperty().add(3));
  getChildren().addAll(text, imageView);
}
public void setAmount(Integer amount) {

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

public BarrelAmountAlwaysVisible() {
  getStylesheets().add(this.getClass().getResource("icons.css").toExternalForm());
  amount = new SimpleStringProperty(this, "amount", "");
  final ImageView imageView = new ImageView(img);
  final Label text = new Label();
  text.getStyleClass().add("iconText");
  text.textProperty().bind(amount);
  imageView.layoutXProperty().bind(text.widthProperty().add(3));
  getChildren().addAll(text, imageView);
}
public void setAmount(Integer amount) {

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

/**
 * {@inheritDoc}
 */
@Override
public void setupBindings() {
  super.setupBindings();
  fieldLabel.textProperty().bind(field.labelProperty());
  comboBox.visibleProperty().bind(field.editableProperty());
  readOnlyLabel.visibleProperty().bind(field.editableProperty().not());
  readOnlyLabel.textProperty().bind(comboBox.valueProperty().asString());
}

相关文章