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

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

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

Label.setLabelFor介绍

暂无

代码示例

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

private StringProperty textLabelProperty = new SimpleStringProperty("");    /**
 *
 */
public Control setLabel(Label label) {
  if (label != null) {
    label.setLabelFor(this);
    textLabelProperty.bind(label.textProperty());
  }
  return this;
}    

public StringProperty labelTextProperty() {
  return textLabelProperty;
}

代码示例来源:origin: no.tornado/tornadofx-controls

private void configureMnemonicTarget( Node target ){
  if( target.getProperties().containsKey("mnemonicTarget") ){
    getLabel().setMnemonicParsing(true);
    getLabel().setLabelFor(target);
  }
}

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

private void addEditorContent(GridPane gridPane, int row, Node editorWidgetContent, Label label) {
//        GridPane.setMargin(editorWidgetContent, new Insets(4, 0, 4, 0));
    label.setLabelFor(editorWidgetContent);

    StackPane pane = new StackPane();
    pane.setAlignment(Pos.CENTER_LEFT);
    pane.getChildren().add(editorWidgetContent);
    pane.setPadding(new Insets(5,3,5,0));
    gridPane.add(pane, 1, row);

    if (row%2==0) {
      pane.setStyle("-fx-background-color: "+ highlightBackground + ";");
    }
  }

代码示例来源:origin: no.tornado/tornadofx-controls

public static void setMnemonicTarget( Node target ){
  Field parent = NodeHelper.findParentOfType( target, Field.class);
  if( parent != null ){
    parent.getLabel().setMnemonicParsing(true);
    parent.getLabel().setLabelFor(target);
  } else {
    // we will detect this when this target is added as an input
    target.getProperties().put("mnemonicTarget",Boolean.TRUE);
  }
}

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

/**
 * Populates the repository details step for the git repository
 */
private void populate() {
  this.urlField = new TextField();
  this.branchField = new TextField("master");
  Label urlLabel = new Label(tr("Git-URL:"));
  urlLabel.setLabelFor(urlField);
  Label branchLabel = new Label(tr("Git-Branch:"));
  branchLabel.setLabelFor(branchField);
  GridPane grid = new GridPane();
  grid.getStyleClass().add("grid");
  grid.add(urlLabel, 0, 0);
  grid.add(urlField, 1, 0);
  grid.add(branchLabel, 0, 1);
  grid.add(branchField, 1, 1);
  this.setCenter(grid);
}

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

((Region)editor).setMaxWidth(Double.MAX_VALUE);
label.setLabelFor(editor);
add(editor, 1, row);
GridPane.setHgrow(editor, Priority.ALWAYS);

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

/**
 * Populates the repository details step for the classpath repository
 */
private void populate() {
  this.classpathField = new TextField();
  Label classpathLabel = new Label(tr("Classpath:"));
  classpathLabel.setLabelFor(classpathField);
  HBox content = new HBox(classpathLabel, classpathField);
  content.setId("addClasspathRepository");
  HBox.setHgrow(classpathField, Priority.ALWAYS);
  this.setCenter(content);
}

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

/**
 * Populates the content of this component
 */
private void populate() {
  choiceBox = new ComboBox<>(repositoryChoices);
  choiceBox.setPromptText(tr("Please select the repository type you want to add"));
  choiceBox.setConverter(new StringConverter<RepositoryType>() {
    @Override
    public String toString(RepositoryType repositoryType) {
      return repositoryType.getLabel();
    }
    @Override
    public RepositoryType fromString(String string) {
      return Arrays.stream(RepositoryType.values()).filter(type -> type.getLabel().equals(string)).findAny()
          .orElse(null);
    }
  });
  choiceBox.setOnAction(
      event -> onRepositoryTypeSelection.accept(choiceBox.getSelectionModel().getSelectedItem()));
  Label choiceBoxLabel = new Label(tr("Repository type:"));
  choiceBoxLabel.setLabelFor(choiceBox);
  HBox content = new HBox(choiceBoxLabel, choiceBox);
  content.setId("repositoryTypeSelection");
  HBox.setHgrow(choiceBox, Priority.ALWAYS);
  this.setCenter(content);
}

相关文章