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

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

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

Label.setGraphic介绍

暂无

代码示例

代码示例来源: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: com.guigarage/ui-basics

public static Label createLabel(String text, Character icon) {
  Label label = new Label(text);
  label.setTextFill(Color.GRAY);
  label.setFont(new Font(20));
  label.setGraphicTextGap(6);
  Text iconT = createIconText(icon, 24);
  iconT.setFill(Color.GRAY);
  label.setGraphic(iconT);
  return label;
}

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

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

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

private void showAutocompletePopup(int insertionIndex, String input) {
  CompletionResultSource suggestionMaker = mySuggestionProvider.get();
  List<MenuItem> suggestions =
    suggestionMaker.getSortedMatches(input, 5)
            .map(result -> {
              Label entryLabel = new Label();
              entryLabel.setGraphic(result.getTextFlow());
              entryLabel.setPrefHeight(5);
              CustomMenuItem item = new CustomMenuItem(entryLabel, true);
              item.setUserData(result);
              item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName()));
              return item;
            })
            .collect(Collectors.toList());
  autoCompletePopup.getItems().setAll(suggestions);
  myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length())
       .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY()));
  Skin<?> skin = autoCompletePopup.getSkin();
  if (skin != null) {
    Node fstItem = skin.getNode().lookup(".menu-item");
    if (fstItem != null) {
      fstItem.requestFocus();
    }
  }
}

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

public DashboardTile(String title, String description, Node graphic) {
  getStyleClass().addAll("dashboard-modules-tile");
  Label titleLabel = new Label(title);
  titleLabel.getStyleClass().add("dashboard-modules-tile-title");
  if (nonNull(graphic)) {
    titleLabel.setGraphic(graphic);
  }
  Label textLabel = new Label(description);
  textLabel.getStyleClass().add("dashboard-modules-tile-text");
  textLabel.setMinHeight(USE_PREF_SIZE);
  VBox topTile = new VBox(5);
  topTile.getChildren().addAll(titleLabel, textLabel);
  button.getStyleClass().add("dashboard-modules-invisible-button");
  button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
  armed.bind(button.armedProperty());
  getChildren().addAll(new StackPane(topTile, button));
  setMaxHeight(USE_PREF_SIZE);
  setMinHeight(USE_PREF_SIZE);
}

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

private void graphicChanged(ObservableValue<? extends Node> observable,
    Node oldValue,
    Node newValue) {
  this.l.setGraphic(newValue);
}

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

Set<Node> items = scatterChart.lookupAll("Label.chart-legend-item");
      int it=0;
      for (Node item : items) {
        Label label = (Label) item;
        label.setGraphic(seriesNodes.get(it));
        it++;
      }

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

protected void buildExpandedcon() {
 final FontIcon expandedIcon = new FontIcon("fa-minus-square-o:16");
 expandedIcon.getStyleClass().add("expand-collapse-icon");
 expandedLabel.setGraphic(expandedIcon);
}

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

protected void buildCollapsedIcon() {
 final FontIcon icon = new FontIcon("fa-plus-square-o:16");
 icon.getStyleClass().add("expand-collapse-icon");
 collpasedLabel.setGraphic(icon);
}

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

public static void setContentLocationSeparator(Label separator) {
 FontIcon icon = new FontIcon("fa-caret-square-o-right:12");
 separator.setGraphic(icon);
 icon.getStyleClass().add("content-location-separator");
}

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

public static void setHeaderLocationSeparator(Label separator) {
 FontIcon icon = new FontIcon("mdi-chevron-right:20");
 separator.setGraphic(icon);
 icon.getStyleClass().add("header-location-separator");
}

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

public static Node getErrorIcon() {
 Label label = new Label();
 FontIcon icon = new FontIcon("fa-exclamation:20");
 label.setGraphic(icon);
 return label;
}

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

/**
 * Get a fa-caret-square-o-right.
 *
 * @return
 */
public static  Node getSep() {
 Label separator = new Label();
 FontIcon icon = new FontIcon("fa-caret-square-o-right:14");
 separator.setGraphic(icon);
 icon.getStyleClass().add("ep-structure-location-item-label-ikonli");
 return separator;
}

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

public static  Node getSep(String iconStyleClass) {
 Label separator = new Label();
 FontIcon icon = new FontIcon("fa-caret-square-o-right:14");
 separator.setGraphic(icon);
 separator.getStyleClass().add(iconStyleClass);
 return separator;
}

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

protected void onSuccess(IOperationResult operationResult) {
 long count = (int) operationResult.getMetaData().get("totalElements");
 if (count > 0) {
  String key = getExtraParameters().get("withRoleBLabel") == null ? WITH_ITEMS : (getExtraParameters().get("withRoleBLabel"));
  label.setText(controller.getLocalised(key, count));
  label.setGraphic(null);
 } else {
  String key = getExtraParameters().get("noRoleBLabel") == null ? NO_ITEMS : (getExtraParameters().get("noRoleBLabel"));
  label.setText(controller.getLocalised(key));
  label.setGraphic(null);
 }
}

代码示例来源: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: de.jensd/fontawesomefx-common

public Label createIconLabel(GlyphIcons icon, String text, String iconSize, String fontSize, ContentDisplay contentDisplay) {
  Text iconLabel = createIcon(icon, iconSize);
  Label label = new Label(text);
  label.setStyle("-fx-font-size: " + fontSize);
  label.setGraphic(iconLabel);
  label.setContentDisplay(contentDisplay);
  return label;
}

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

private Label createProgressIndicator() {
    Label graphic = new Label();
    graphic.setGraphic(getSkinnable().getProgressNode());
    graphic.visibleProperty().bind(getSkinnable().progressVisibleProperty());
    graphic.getStyleClass().add("masker-graphic"); //$NON-NLS-1$
    return graphic;
  }
}

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

private Node createDecorationNode(ValidationMessage message) {
  Node graphic = Severity.ERROR == message.getSeverity() ? createErrorNode() : createWarningNode();
  graphic.setStyle(SHADOW_EFFECT);
  Label label = new Label();
  label.setGraphic(graphic);
  label.setTooltip(createTooltip(message));
  label.setAlignment(Pos.CENTER);
  return label;
}

相关文章