javafx.scene.control.Label类的使用及代码示例

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

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

Label介绍

暂无

代码示例

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

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);
selectedHourLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedHourLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.HOURS));
selectedHourLabel.setMinWidth(49);
selectedHourLabel.setAlignment(Pos.CENTER_RIGHT);
timeLabel.set(selectedHourLabel);
selectedMinLabel.setText(String.valueOf(unitConverter.toString(time.getMinute())));
selectedMinLabel.getStyleClass().add(SPINNER_LABEL);
selectedMinLabel.setTextFill(fadedColor);
selectedMinLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedMinLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.MINUTES));
Label separatorLabel = new Label(":");
separatorLabel.setPadding(new Insets(0, 0, 4, 0));
separatorLabel.setTextFill(fadedColor);
separatorLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
periodPMLabel = new Label("PM");
periodPMLabel.getStyleClass().add(SPINNER_LABEL);
periodPMLabel.setTextFill(fadedColor);
periodPMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
periodPMLabel.setOnMouseClicked((click) -> period.set("PM"));
periodAMLabel = new Label("AM");
periodAMLabel.getStyleClass().add(SPINNER_LABEL);
periodAMLabel.setTextFill(fadedColor);

代码示例来源: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: 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

private void swapLabelsColor(Label lbl1, Label lbl2) {
  Paint color = lbl1.getTextFill();
  lbl1.setTextFill(lbl2.getTextFill());
  lbl2.setTextFill(color);
}

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

@Override
  public Node view() {
    final Label label = new Label(String.valueOf(character));
    label.getStyleClass().add("glyph-icon");
    return label;
  }
}

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

@Override
public Node createLabel() {
  final Label l = new Label(label);
  l.setTooltip( new Tooltip(tooltip) );
  return l;
}

代码示例来源: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: ch.sahits.game/OpenPatricianJavaFX

public CoinPriceAlwaysVisible() {
  amount = new SimpleStringProperty(this, "amount", "");
  getStylesheets().add(this.getClass().getResource("icons.css").toExternalForm());
  
  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: jfoenixadmin/JFoenix

protected BorderPane createCalendarMonthLabelPane() {
  monthYearLabel = new Label();
  monthYearLabel.getStyleClass().add(SPINNER_LABEL);
  monthYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 13));
  monthYearLabel.setTextFill(DEFAULT_COLOR);
  BorderPane monthContainer = new BorderPane();
  monthContainer.setMinHeight(50);
  monthContainer.setCenter(monthYearLabel);
  monthContainer.setPadding(new Insets(2, 12, 2, 12));
  return monthContainer;
}

代码示例来源: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);
  StackPane labelContainer = new StackPane();
  int val = ((i + 3) * 5) % 60;
  Label label = new Label(String.valueOf(unitConverter.toString(val)));
  label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
  label.setTextFill(val == time.getMinute() ?
    Color.rgb(255, 255, 255, 0.87) : Color.rgb(0, 0, 0, 0.87));
  selectedMinLabel.textProperty().addListener((o, oldVal, newVal) -> {
    if (Integer.parseInt(newVal) == Integer.parseInt(label.getText())) {
      label.setTextFill(Color.rgb(255, 255, 255, 0.87));
    } else {
      label.setTextFill(Color.rgb(0, 0, 0, 0.87));

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

@Override
  public Label fromString(String string) {
    return new Label(string);
  }
});

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

public JFXSnackbarLayout(String message, String actionText, EventHandler<ActionEvent> actionHandler) {
  initialize();
  toast = new Label();
  toast.setMinWidth(Control.USE_PREF_SIZE);
  toast.getStyleClass().add("jfx-snackbar-toast");
  toast.setWrapText(true);
  toast.setText(message);
  StackPane toastContainer = new StackPane(toast);
  toastContainer.setPadding(new Insets(20));
  actionContainer.setPadding(new Insets(0, 10, 0, 0));
  toast.prefWidthProperty().bind(Bindings.createDoubleBinding(() -> {
    if (getPrefWidth() == -1) {
      return getPrefWidth();

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

protected static Label createValueLabel() {
    Label ret = new Label();
    ret.getStyleClass().add("info-property-value");
    ret.setWrapText(true);
    return ret;
  }
}

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

private Label buildLabel(String message, NotificationType type) {
  Label textLabel = new Label(message);
  textLabel.getStyleClass().add("notification-text");
  if (type != null) {
    textLabel.getStyleClass().add(type.getStyleClass());
    textLabel.setGraphic(type.getGraphic());
  }
  return textLabel;
}

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

displayNode = new Label("");
displayNode.getStyleClass().add("color-label");
displayNode.setManaged(false);
displayNode.setMouseTransparent(true);
updateColor();
final JFXRippler rippler = new JFXRippler(colorBox, JFXRippler.RipplerMask.FIT);
rippler.ripplerFillProperty().bind(displayNode.textFillProperty());
getChildren().setAll(rippler);
JFXDepthManager.setDepth(getSkinnable(), 1);
  if (displayNode != null) {
    if (colorLabelVisible.get()) {
      displayNode.setText(JFXNodeUtils.colorToHex(getSkinnable().getValue()));
    } else {
      displayNode.setText("");

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

private void addLegend() {
  if (legend == null) {
    legend = new Label();
    legend.textProperty().bind(textProperty());
    legend.getStyleClass().add("legend");
    getChildren().add(0, legend);
  }
  legend.setGraphic(getIcon());
}

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

details.setMinSize(GridPane.USE_PREF_SIZE, GridPane.USE_PREF_SIZE);
Label sizeCalculator = new Label("999");
Group sizingRoot = new Group(sizeCalculator);
new Scene(sizingRoot);
sizingRoot.applyCss();
sizingRoot.layout();
sizeLabel.setMinWidth(25);
sizeLabel.setPrefWidth(sizeCalculator.getWidth());
sizeLabel.setAlignment(Pos.BASELINE_RIGHT);
sizeControl.prefWidthProperty().bind(colorPicker.widthProperty());
details.addRow(0, new Label("Id"), idLabel);
details.addRow(1, new Label("Name"), nameLabel);
details.addRow(2, new Label("Color"), colorPicker);
details.addRow(3, new Label("Size"), sizeControl);
sizeLabel.textProperty().bind(sizeSlider.valueProperty().asString("%.0f"));

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

/**
 * {@inheritDoc}
 */
@Override
public Node getDisplayNode(List<IListFormValue> values) {
 final Label valueLabel = new Label();
 valueLabel.setWrapText(true);
 valueLabel.setOpacity(0.44);
 if (values != null && values.isEmpty()) {
  valueLabel.setText(values.get(0).getDisplayedValue());
 }
 return valueLabel;
}

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

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

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

setSpacing(0);
errorLabel = new Label();
errorLabel.getStyleClass().add("error-label");
errorLabel.setWrapText(true);
errorLabel.heightProperty().addListener((o, oldVal, newVal) -> {
  if (errorShown) {
    if (oldErrorLabelHeight == -1) {

相关文章