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

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

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

Label.<init>介绍

暂无

代码示例

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

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

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

@Override
  public Label fromString(String string) {
    return string == null || string.isEmpty() ? null : new Label(string);
  }
});

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

private static Label log(String message, String type) {
  final Label label = new Label(message);
  label.getStyleClass().addAll("msg", type);
  return label;
}

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

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

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

@Override
public void start(Stage primaryStage) throws Exception {
  JFXToolbar jfxToolbar = new JFXToolbar();
  jfxToolbar.setLeftItems(new Label("Left"));
  jfxToolbar.setRightItems(new Label("Right"));
  StackPane main = new StackPane();
  main.getChildren().add(jfxToolbar);
  Scene scene = new Scene(main, 600, 400);
  scene.getStylesheets().add(ToolBarDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
  primaryStage.setScene(scene);
  primaryStage.show();
}

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

@Override
public void start(Stage primaryStage) throws Exception {
  JFXComboBox<Label> combo = new JFXComboBox<>();
  combo.getItems().add(new Label("Java 1.8"));
  combo.getItems().add(new Label("Java 1.7"));
  combo.getItems().add(new Label("Java 1.6"));
  combo.getItems().add(new Label("Java 1.5"));
  combo.setEditable(true);
  combo.setPromptText("Select Java Version");
  combo.setConverter(new StringConverter<Label>() {
    @Override
    public String toString(Label object) {
      return object==null? "" : object.getText();
    }
    @Override
    public Label fromString(String string) {
      return new Label(string);
    }
  });
  HBox pane = new HBox(100);
  HBox.setMargin(combo, new Insets(20));
  pane.setStyle("-fx-background-color:WHITE");
  pane.getChildren().add(combo);
  final Scene scene = new Scene(pane, 300, 300);
  scene.getStylesheets().add(ComboBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
  primaryStage.setTitle("JFX ComboBox Demo");
  primaryStage.setScene(scene);
  primaryStage.setResizable(false);
  primaryStage.show();
}

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

@Override
public void start(Stage stage) {
  Pane root = new Pane();
  for(int i = 0 ;i < 4000; i++) {
    Label child = new Label("label" + i);
    child.setLayoutX(Math.random() * 500 + 100);
    child.setLayoutY(Math.random() * 500+ 100);
    root.getChildren().add(child);
  }
  root.getChildren().add(build());
  FPSDecorator decorator = new FPSDecorator(stage, root);
  final Scene scene = new Scene(decorator, 800, 800);
  stage.setScene(scene);
  stage.setResizable(true);
  stage.show();
  afterShow(stage);
}

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

private ContextMenu buildContextMenu(Node item) {
  ContextMenu contextMenu = new ContextMenuWithNoArrows();
  CustomMenuItem menuItem = new CustomMenuItem(new Label("Copy subtree test to clipboard..."));
  Tooltip tooltip = new Tooltip("Creates a node spec using the Kotlin AST matcher DSL, and dumps it to the clipboard");
  Tooltip.install(menuItem.getContent(), tooltip);
  menuItem.setOnAction(e -> {
    Clipboard clipboard = Clipboard.getSystemClipboard();
    ClipboardContent content = new ClipboardContent();
    content.putString(dumpToSubtreeTest(item)); // item is captured in the closure
    clipboard.setContent(content);
  });
  contextMenu.getItems().add(menuItem);
  return contextMenu;
}

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

@Override
public void start(Stage primaryStage) throws Exception {
  JFXHamburger show = new JFXHamburger();
  show.setPadding(new Insets(10, 5, 10, 5));
  JFXRippler rippler = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK);
  JFXListView<Label> list = new JFXListView<>();
  for (int i = 1; i < 5; i++) {
    list.getItems().add(new Label("Item " + i));
  }
  AnchorPane container = new AnchorPane();
  container.getChildren().add(rippler);
  AnchorPane.setLeftAnchor(rippler, 200.0);
  AnchorPane.setTopAnchor(rippler, 210.0);
  StackPane main = new StackPane();
  main.getChildren().add(container);
  JFXPopup popup = new JFXPopup(list);
  rippler.setOnMouseClicked(e -> popup.show(rippler, PopupVPosition.TOP, PopupHPosition.LEFT));
  final Scene scene = new Scene(main, 800, 800);
  scene.getStylesheets().add(PopupDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
  primaryStage.setTitle("JFX Popup Demo");
  primaryStage.setScene(scene);
  primaryStage.setResizable(false);
  primaryStage.show();
}

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

public void refreshBadge() {
  badge.getChildren().clear();
  if (enabled) {
    Label labelControl = new Label(text.getValue());
    StackPane badgePane = new StackPane();
    badgePane.getStyleClass().add("badge-pane");
    badgePane.getChildren().add(labelControl);
    //Adding a clip would avoid overlap but this does not work as intended
    //badgePane.setClip(clip);
    badge.getChildren().add(badgePane);
    StackPane.setAlignment(badge, getPosition());
    FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
    ft.setFromValue(0);
    ft.setToValue(1.0);
    ft.setCycleCount(1);
    ft.setAutoReverse(true);
    ft.play();
  }
}

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

@Override
protected void afterShow(Stage stage) {
  JFXDialogLayout layout = new JFXDialogLayout();
  layout.setBody(new Label("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."));
  JFXAlert<Void> alert = new JFXAlert<>(stage);
  alert.setOverlayClose(true);
  alert.setAnimation(JFXAlertAnimation.CENTER_ANIMATION);
  alert.setContent(layout);
  alert.initModality(Modality.NONE);
  leftButton.setOnAction(action-> alert.showAndWait());
}

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

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

@Override
public Label createNode() {
  final Label label = new Label("");
  events.on(BeforeGenerate.class, bg -> runLater(() -> label.setText("Generating...")));
  events.on(FileGenerated.class, fg -> runLater(() -> label.setText(fg.meta().getModel().getName())));
  events.on(AfterGenerate.class, ag -> runLater(() -> label.setText("")));
  return label;
}

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

JFXListView<Label> list = new JFXListView<>();
for (int i = 0; i < 100; i++) {
  list.getItems().add(new Label("Item " + i));
pane.getTopBar().getChildren().add(button);
Label title = new Label("Title");
pane.getBottomBar().getChildren().add(title);
title.setStyle("-fx-text-fill:WHITE; -fx-font-size: 40;");

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

public JFXDefaultChip(JFXChipView<T> view, T item) {
    super(view, item);
    JFXButton closeButton = new JFXButton(null, new SVGGlyph());
    closeButton.getStyleClass().add("close-button");
    closeButton.setOnAction((event) -> view.getChips().remove(item));

    String tagString = null;
    if (getItem() instanceof String) {
      tagString = (String) getItem();
    } else {
      tagString = view.getConverter().toString(getItem());
    }
    Label label = new Label(tagString);
    label.setWrapText(true);
    root = new HBox(label, closeButton);
    getChildren().setAll(root);
    label.setMaxWidth(100);
  }
}

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

@Override
protected void beforeParentInit() {
  xpathAttributesListView.setPlaceholder(new Label("No available attributes"));
  EventStreams.valuesOf(scopeHierarchyTreeView.getSelectionModel().selectedItemProperty())
        .filter(Objects::nonNull)
        .map(TreeItem::getValue)
        .filterMap(o -> o instanceof NameDeclaration, o -> (NameDeclaration) o)
        .filter(nd -> !Objects.equals(nd.getNode(), selectedNode))
        .subscribe(declaration -> Platform.runLater(() -> parent.onNodeItemSelected(declaration.getNode(), true)));
  scopeHierarchyTreeView.setCellFactory(view -> new ScopeHierarchyTreeCell());
  hideCommonAttributesProperty()
    .values()
    .distinct()
    .subscribe(show -> displayAttributes(selectedNode));
}

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

@Override
protected Node createUndecoratedEditor() {
  
  final CheckBox cbNull               = new CheckBox();
  final Node wrappedCb                = ItemUtil.lockDecorator(cbNull, document, ItemUtil.DATABASE_RELATION_TOOLTIP);
  final Label label                   = new Label(IMPLEMENTATION_TITLE);
  final ChoiceBox<ImplementAs> cbImpl = new ChoiceBox<>(
    observableArrayList(ImplementAs.values())
  );
  
  cbImpl.setTooltip(new Tooltip(IMPLEMENTATION_TOOLTIP));
  
  final HBox right = new HBox(label, cbImpl);
  final HBox left = new HBox(wrappedCb, right);
  
  left.setSpacing(16);
  right.setSpacing(8);
  right.setAlignment(Pos.CENTER);
  
  cbNull.selectedProperty().bindBidirectional(nullable);
  cbImpl.valueProperty().bindBidirectional(implementation);
  
  right.visibleProperty().bind(nullable);
  right.disableProperty().bind(nullable.not());
  
  return left;
}

相关文章