@Override public Label fromString(String string) { return new Label(string); } });
@Override public Label fromString(String string) { return string == null || string.isEmpty() ? null : new Label(string); } });
@Override public Node view() { final Label label = new Label(String.valueOf(character)); label.getStyleClass().add("glyph-icon"); return label; } }
private static Label log(String message, String type) { final Label label = new Label(message); label.getStyleClass().addAll("msg", type); return label; }
@Override public Node createLabel() { final Label l = new Label(label); l.setTooltip( new Tooltip(tooltip) ); return l; }
@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(); }
@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(); }
@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); }
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; }
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; }
@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(); }
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(); } } }
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(); } }
@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()); }
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);
@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; }
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;");
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); } }
@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)); }
@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; }