javafx.scene.control.Label#setText ( )源码实例Demo

下面列出了javafx.scene.control.Label#setText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jmonkeybuilder   文件: TextureLayerCell.java
/**
 * Refresh this cell.
 */
protected void refresh() {

    final TextureLayer item = getItem();
    if (item == null) return;

    setIgnoreListeners(true);
    try {

        final FloatTextField scaleField = getScaleField();
        scaleField.setValue(item.getScale());

        final NamedChooseTextureControl normalTextureControl = getNormalTextureControl();
        normalTextureControl.setTextureFile(item.getNormalFile());

        final NamedChooseTextureControl diffuseTextureControl = getDiffuseTextureControl();
        diffuseTextureControl.setTextureFile(item.getDiffuseFile());

        final Label layerField = getLayerField();
        layerField.setText(Messages.MODEL_PROPERTY_LAYER + " #" + (item.getLayer() + 1));

    } finally {
        setIgnoreListeners(false);
    }
}
 
源代码2 项目: FlyingAgent   文件: ScanAllController.java
private void addDiskBox(Disk disk) {
    try {
        Parent parentDisk = FXMLLoader.load(getClass().getResource("/resources/views/models/DiskInfo.fxml"));
        //Label lblName = (Label) parentDisk.lookup("#lblName");
        Label lblTotalSpace = (Label) parentDisk.lookup("#lblTotalSpace");
        PieChart pieData = (PieChart) parentDisk.lookup("#pieData");

        pieData.setTitle(disk.getName());
        lblTotalSpace.setText(Utils.humanReadableByteCount(disk.getTotalSpace()));

        // Data of pie chart
        ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
        data.add(new PieChart.Data("Usable", Utils.humanReadableByteCountNumber(disk.getUsableSpace())));
        data.add(new PieChart.Data("Free", Utils.humanReadableByteCountNumber(disk.getFreeSpace())));

        pieData.setData(data);
        pieData.getData().forEach(d ->
                d.nameProperty().bind(Bindings.concat(d.getName(), " ", d.pieValueProperty(), " GB"))
        );
        boxContainerDisks.getChildren().add(parentDisk);
    } catch (IOException ioe) {
        ioe.printStackTrace();
    }
}
 
源代码3 项目: HubTurbo   文件: PickerLabel.java
@Override
public Node getNode() {
    // actual name for labels at the top, add tick for selected labels
    Label label = new Label((canDisplayFullName ? getFullName() : getShortName()));
    setLabelStyle(label);
    label.setText(label.getText() + (!canDisplayFullName && isSelected ? " ✓" : ""));

    FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
    double width = fontLoader.computeStringWidth(label.getText(), label.getFont());
    label.setPrefWidth(width + 30);

    if (isInGroup()) {
        Tooltip groupTooltip = new Tooltip(getGroupName());
        label.setTooltip(groupTooltip);
    }

    setupEvents(label);
    return label;
}
 
源代码4 项目: Path-of-Leveling   文件: SocketGroupListCell.java
@Override
protected void updateItem(SocketGroup sg, boolean empty) {
    super.updateItem(sg, empty) ;
    if (empty) {
        setText(null);
    } else {
        Label l = new Label();
        if(sg.getActiveGem()!=null){
            if(!sg.getActiveGem().getGemName().equals("<empty group>")){
                l.setGraphic(new ImageView(sg.getActiveGem().getSmallIcon()));
                l.setText(sg.getActiveGem().getGemName());
            }
        }
        else{
            setText(null);
        }
        setGraphic(l);

    }
}
 
源代码5 项目: jmonkeybuilder   文件: ChooseTextureControl.java
/**
 * Reload.
 */
@FxThread
protected void reload() {

    final ImageChannelPreview textureTooltip = getTextureTooltip();
    final Label textureLabel = getTextureLabel();
    final ImageView preview = getTexturePreview();

    final Path textureFile = getTextureFile();

    if (textureFile == null) {
        textureLabel.setText(Messages.MATERIAL_MODEL_PROPERTY_CONTROL_NO_TEXTURE);
        preview.setImage(null);
        textureTooltip.clean();
        return;
    }

    final Path assetFile = notNull(getAssetFile(textureFile));

    textureLabel.setText(assetFile.toString());
    preview.setImage(IMAGE_MANAGER.getImagePreview(textureFile, 28, 28));
    textureTooltip.showImage(textureFile);
}
 
源代码6 项目: DashboardFx   文件: Dialog.java
private static VBox  createContent(String title, String message){
    VBox container = new VBox();
    container.setAlignment(Pos.TOP_CENTER);
    container.setSpacing(20D);

    VBox.setMargin(container, new Insets(10,0,0,0));

    Label lblTitle = new Label(title);
    lblTitle.getStyleClass().add("h2");

    Label text = new Label();
    text.setWrapText(true);
    text.setText(message);
    text.setMaxWidth(420);
    text.setAlignment(Pos.CENTER);
    text.setStyle("-fx-text-fill : -text-color; ");

    container.getChildren().addAll(lblTitle, text);

    return container;
}
 
源代码7 项目: HubTurbo   文件: PickerRepository.java
public Node getNode() {
    Label repoLabel = new Label();
    repoLabel.setPrefWidth(REPO_LABEL_PREFERRED_WIDTH);
    repoLabel.setPadding(DEFAULT_REPO_LABEL_PADDING);

    if (isSelected) {
        repoLabel.setText(repositoryId);
        repoLabel.setStyle(COMMON_REPO_LABEL_STYLE + SELECTED_REPO_LABEL_STYLE);
    } else {
        repoLabel.setText(repositoryId);
        repoLabel.setStyle(COMMON_REPO_LABEL_STYLE + DEFAULT_REPO_LABEL_STYLE);
    }

    return repoLabel;
}
 
源代码8 项目: bisq   文件: DaoLaunchWindow.java
private void createContent() {
    HBox slidingContentWithPagingBox = new HBox();
    slidingContentWithPagingBox.setPadding(new Insets(30, 0, 0, 0));
    slidingContentWithPagingBox.setAlignment(Pos.CENTER);
    Button prevButton = getIconButton(MaterialDesignIcon.ARROW_LEFT, "dao-launch-paging-button");
    prevButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToPrevSection();
    });
    Button nextButton = getIconButton(MaterialDesignIcon.ARROW_RIGHT, "dao-launch-paging-button");
    nextButton.setOnAction(event -> {
        autoPlayTimeline.stop();
        goToNextSection();
    });
    VBox slidingContent = new VBox();
    slidingContent.setMinWidth(616);
    slidingContent.setSpacing(20);
    sectionDescriptionLabel = new Label();
    sectionDescriptionLabel.setTextAlignment(TextAlignment.CENTER);
    sectionDescriptionLabel.getStyleClass().add("dao-launch-description");
    sectionDescriptionLabel.setMaxWidth(562);
    sectionDescriptionLabel.setWrapText(true);


    selectedSection = sections.get(currentSectionIndex.get());

    sectionDescriptionLabel.setText(selectedSection.description);
    sectionScreenshot = new ImageView();
    sectionScreenshot.setOpacity(0);
    sectionScreenshot.setId(selectedSection.imageId);

    slidingContent.setAlignment(Pos.CENTER);
    slidingContent.getChildren().addAll(sectionDescriptionLabel, sectionScreenshot);
    slidingContentWithPagingBox.getChildren().addAll(prevButton, slidingContent, nextButton);

    GridPane.setRowIndex(slidingContentWithPagingBox, ++rowIndex);
    GridPane.setColumnSpan(slidingContentWithPagingBox, 2);
    GridPane.setHgrow(slidingContent, Priority.ALWAYS);
    gridPane.getChildren().add(slidingContentWithPagingBox);
}
 
源代码9 项目: SmartCity-ParkingManagement   文件: ConfirmBox.java
public boolean display(final String title, final String message) {
	final Stage window = new Stage();
	window.initModality(Modality.APPLICATION_MODAL);
	window.setTitle(title);
	window.setMinWidth(250);
	window.setMinHeight(150);
	window.getIcons().add(new Image(getClass().getResourceAsStream("Smart_parking_icon.png")));

	final Label label = new Label();
	label.setText(message);

	yesButton = new Button("Yes");
	yesButton.setOnAction(λ -> {

		answer = true;
		window.close();
	});

	noButton = new Button("No");
	noButton.setOnAction(λ -> {
		answer = false;
		window.close();
	});

	final VBox layout = new VBox();
	layout.getChildren().addAll(label, noButton, yesButton);
	layout.setAlignment(Pos.CENTER);
	final Scene scene = new Scene(layout);
	scene.getStylesheets().add(getClass().getResource("mainStyle.css").toExternalForm());
	window.setScene(scene);
	window.showAndWait();

	return answer;
}
 
源代码10 项目: bisq   文件: MainView.java
private void updateMarketPriceLabel(Label label) {
    if (model.getIsPriceAvailable().get()) {
        if (model.getIsExternallyProvidedPrice().get()) {
            label.setText(Res.get("mainView.marketPriceWithProvider.label", getPriceProvider()));
            label.setTooltip(new Tooltip(getPriceProviderTooltipString()));
        } else {
            label.setText(Res.get("mainView.marketPrice.bisqInternalPrice"));
            final Tooltip tooltip = new Tooltip(Res.get("mainView.marketPrice.tooltip.bisqInternalPrice"));
            label.setTooltip(tooltip);
        }
    } else {
        label.setText("");
        label.setTooltip(null);
    }
}
 
public void generateLabel(){
    sgLabel = new Label();
    if(sg == null){
        sg = new SocketGroup(); //creating dummie
    }
    if(sg.getActiveGem()!=null){
      Image img = sg.getActiveGem().getSmallIcon(); 
      sgLabel.setGraphic(new ImageView(img));
      sgLabel.setText(sg.getActiveGem().getGemName());
    }else{
        sgLabel.setText("<empty group>");
    }      
}
 
源代码12 项目: bisq   文件: GUIUtil.java
public static Callback<ListView<PaymentMethod>, ListCell<PaymentMethod>> getPaymentMethodCellFactory() {
    return p -> new ListCell<>() {
        @Override
        protected void updateItem(PaymentMethod method, boolean empty) {
            super.updateItem(method, empty);

            if (method != null && !empty) {
                String id = method.getId();

                HBox box = new HBox();
                box.setSpacing(20);
                Label paymentType = new AutoTooltipLabel(
                        method.isAsset() ? Res.get("shared.crypto") : Res.get("shared.fiat"));

                paymentType.getStyleClass().add("currency-label-small");
                Label paymentMethod = new AutoTooltipLabel(Res.get(id));
                paymentMethod.getStyleClass().add("currency-label");
                box.getChildren().addAll(paymentType, paymentMethod);

                if (id.equals(GUIUtil.SHOW_ALL_FLAG)) {
                    paymentType.setText(Res.get("shared.all"));
                    paymentMethod.setText(Res.get("list.currency.showAll"));
                }

                setGraphic(box);

            } else {
                setGraphic(null);
            }
        }
    };
}
 
源代码13 项目: phoebus   文件: AlarmTableUI.java
/** Limit the number of alarms
 *  @param alarms List of alarms, may be trimmed
 *  @param alarm_count Label where count will be shown
 *  @param message Message to use for the count
 */
private void limitAlarmCount(final List<AlarmInfoRow> alarms,
                             final Label alarm_count, final String message)
{
    final int N = alarms.size();
    final StringBuilder buf = new StringBuilder();
    buf.append(message).append(N);
    if (N > AlarmSystem.alarm_table_max_rows)
    {
        buf.append(" (").append(N - AlarmSystem.alarm_table_max_rows).append(" not shown)");
        alarms.subList(AlarmSystem.alarm_table_max_rows, N).clear();
    }
    alarm_count.setText(buf.toString());
}
 
源代码14 项目: houdoku   文件: LayoutHelpers.java
/**
 * Create the container for displaying a series cover, for use in FlowPane layouts where covers
 * are shown in a somewhat grid-like fashion.
 *
 * @param container the parent FlowPane container
 * @param title     the title of the series being represented
 * @param cover     the cover of the series being represented; this ImageView is not modified, a
 *                  copy is made to be used in the new container
 * @return a StackPane which displays the provided title and cover and can be added to the
 *         FlowPane
 */
public static StackPane createCoverContainer(FlowPane container, String title,
        ImageView cover) {
    StackPane result_pane = new StackPane();
    result_pane.setAlignment(Pos.BOTTOM_LEFT);

    // create the label for showing the series title
    Label label = new Label();
    label.setText(title);
    label.getStyleClass().add("coverLabel");
    label.setWrapText(true);

    // We create a new ImageView for the cell instead of using the result's cover ImageView
    // since we may not want to mess with the sizing of the result's cover -- particularly if we
    // want to have additional result layouts.
    ImageView image_view = new ImageView();
    applyCoverSizing(image_view);
    image_view.fitWidthProperty().bind(result_pane.prefWidthProperty());
    image_view.imageProperty().bind(cover.imageProperty());

    image_view.setEffect(COVER_ADJUST_DEFAULT);
    image_view.getStyleClass().add("coverImage");

    // create the mouse event handlers for the result pane
    result_pane.setOnMouseEntered(t -> {
        image_view.setEffect(COVER_ADJUST_HOVER);
        setChildButtonVisible(result_pane, true);
    });
    result_pane.setOnMouseExited(t -> {
        image_view.setEffect(COVER_ADJUST_DEFAULT);
        setChildButtonVisible(result_pane, false);
    });

    result_pane.getChildren().addAll(image_view, label);

    return result_pane;
}
 
源代码15 项目: mars-sim   文件: MainScene.java
public Label createLabelRight(String tip) {
	Label l = new Label();
	l.setAlignment(Pos.CENTER);
	// upTimeLabel.setEffect(blend);
	l.setStyle(LABEL_CSS_STYLE);
	l.setPadding(new Insets(1, 1, 1, 2));
	if (uptimer != null)
		l.setText(uptimer.getUptime());
	setQuickToolTip(l, tip);
	return l;
}
 
源代码16 项目: oim-fx   文件: LabelTest.java
@Override
public void start(Stage primaryStage) {
	try {
		Group root = new Group();
		Scene scene = new Scene(root, 400, 400);
		Pane p = new Pane();
		p.setPrefSize(400, 400);
		p.setBackground(new Background(new BackgroundFill(Color.GOLD,
				null, null)));
		root.getChildren().add(p);

		primaryStage.setScene(scene);
		primaryStage.setTitle("Conversation about Bubbles with Elltz");
		primaryStage.show();
		Label bl1 = new Label();
		bl1.relocate(10, 50);
		bl1.setText("Hi Elltz -:)");
		bl1.setBackground(new Background(new BackgroundFill(Color.YELLOWGREEN,
				null, null)));

		Label bl2 = new Label();
		bl2.relocate(310, 100);
		bl2.setText("Heloooo Me");
		bl2.setBackground(new Background(new BackgroundFill(Color.GREENYELLOW,
				null, null)));

		Label bl3 = new Label();
		bl3.relocate(10, 150);
		bl3.setText("you know this would be a nice library");
		bl3.setBackground(new Background(new BackgroundFill(Color.YELLOWGREEN,
				null, null)));

		Label bl4 = new Label();
		bl4.relocate(165, 200);
		bl4.setText("uhmm yea, kinda, but yknow,im tryna \nact like im not impressed");
		bl4.setBackground(new Background(new BackgroundFill(Color.GREENYELLOW,
				null, null)));

		Label bl5 = new Label();
		bl5.relocate(10, 250);
		bl5.setText("yea! yea! i see that, lowkey.. you not gonna\n get upvotes though..lmao");
		bl5.setBackground(new Background(new BackgroundFill(Color.YELLOWGREEN,
				null, null)));

		Label bl6 = new Label();
		bl6.relocate(165, 300);
		bl6.setText("Man! shut up!!.. what you know about\n upvotes.");
		bl6.setBackground(new Background(new BackgroundFill(Color.GREENYELLOW,
				null, null)));

		p.getChildren().addAll(bl1, bl2, bl3, bl4, bl5, bl6);

	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
源代码17 项目: bisq   文件: GUIUtil.java
public static Callback<ListView<TradeCurrency>, ListCell<TradeCurrency>> getTradeCurrencyCellFactory(String postFixSingle,
                                                                                                     String postFixMulti,
                                                                                                     Map<String, Integer> offerCounts) {
    return p -> new ListCell<>() {
        @Override
        protected void updateItem(TradeCurrency item, boolean empty) {
            super.updateItem(item, empty);

            if (item != null && !empty) {

                String code = item.getCode();

                HBox box = new HBox();
                box.setSpacing(20);
                Label currencyType = new AutoTooltipLabel(
                        CurrencyUtil.isFiatCurrency(item.getCode()) ? Res.get("shared.fiat") : Res.get("shared.crypto"));

                currencyType.getStyleClass().add("currency-label-small");
                Label currency = new AutoTooltipLabel(item.getCode());
                currency.getStyleClass().add("currency-label");
                Label offers = new AutoTooltipLabel(item.getName());
                offers.getStyleClass().add("currency-label");

                box.getChildren().addAll(currencyType, currency, offers);

                Optional<Integer> offerCountOptional = Optional.ofNullable(offerCounts.get(code));

                switch (code) {
                    case GUIUtil.SHOW_ALL_FLAG:
                        currencyType.setText(Res.get("shared.all"));
                        currency.setText(Res.get("list.currency.showAll"));
                        break;
                    case GUIUtil.EDIT_FLAG:
                        currencyType.setText(Res.get("shared.edit"));
                        currency.setText(Res.get("list.currency.editList"));
                        break;
                    default:
                        offerCountOptional.ifPresent(numOffer -> offers.setText(offers.getText() + " (" + numOffer + " " +
                                (numOffer == 1 ? postFixSingle : postFixMulti) + ")"));
                }

                setGraphic(box);

            } else {
                setGraphic(null);
            }
        }
    };
}
 
源代码18 项目: OEE-Designer   文件: CalendarTileSkin.java
private void drawCells() {
    List<ChartData> dataList   = tile.getChartData();
    ZonedDateTime   time       = tile.getTime();
    Locale          locale     = tile.getLocale();
    int             day        = time.getDayOfMonth();
    int             startDay   = time.withDayOfMonth(1).getDayOfWeek().getValue();
    long            lastDay    = time.range(DAY_OF_MONTH).getMaximum();
    Color           textColor  = tile.getTextColor();
    Color           bkgColor   = tile.getBackgroundColor();
    Font            regFont    = Fonts.latoRegular(size * 0.045);
    Font            bldFont    = Fonts.latoBold(size * 0.045);
    Background      bkgToday   = new Background(new BackgroundFill(tile.getBarColor(), new CornerRadii(size * 0.0125), new Insets(2)));
    Border          appmntBorder = new Border(new BorderStroke(tile.getAlarmColor(),
                                                               tile.getAlarmColor(),
                                                               tile.getAlarmColor(),
                                                               tile.getAlarmColor(),
                                                               BorderStrokeStyle.SOLID,
                                                               BorderStrokeStyle.SOLID,
                                                               BorderStrokeStyle.SOLID,
                                                               BorderStrokeStyle.SOLID,
                                                               new CornerRadii(size * 0.0125), BorderWidths.DEFAULT,
                                                               new Insets(1)));
    boolean counting = false;
    int dayCounter = 1;
    for (int y = 0 ; y < 7 ; y++) {
        for (int x = 0 ; x < 8 ; x++) {
            int index = y * 8 + x;
            Label label = labels.get(index);

            String text;
            if (x == 0 && y == 0) {
                text = "";
                label.setManaged(false);
                label.setVisible(false);
            } else if (y == 0) {
                text = DayOfWeek.of(x).getDisplayName(TextStyle.SHORT, locale);
                //label.setTextFill(x == 7 ? Tile.RED : textColor);
                label.setTextFill(textColor);
                label.setFont(bldFont);
            } else if (x == 0) {
                text = Integer.toString(time.withDayOfMonth(1).plusDays((y - 1) * 7).get(IsoFields.WEEK_OF_WEEK_BASED_YEAR));
                label.setTextFill(Tile.GRAY);
                label.setFont(regFont);
                label.setBorder(weekBorder);
            } else {
                if (index - 7 > startDay) {
                    counting = true;
                    text = Integer.toString(dayCounter);

                    LocalDate currentDay = time.toLocalDate().plusDays(dayCounter - 1);
                    long appointments    = dataList.stream().filter(data -> data.getTimestampAsLocalDate().isEqual(currentDay)).count();

                    if (x == 7) {
                        if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); }
                        label.setTextFill(Tile.RED);
                        label.setFont(regFont);
                    } else if (dayCounter == day) {
                        if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); }
                        label.setBackground(bkgToday);
                        label.setTextFill(bkgColor);
                        label.setFont(bldFont);
                    } else {
                        if (appointments > 0) { label.setBorder(appmntBorder); } else { label.setBorder(null); }
                        label.setTextFill(textColor);
                        label.setFont(regFont);
                    }
                } else {
                    text = "";
                    label.setManaged(false);
                    label.setVisible(false);
                }
                if (dayCounter > lastDay) {
                    text = "";
                    label.setManaged(false);
                    label.setVisible(false);
                }
                if (counting) { dayCounter++; }
            }

            label.setText(text);
            label.setVisible(true);
            label.setManaged(true);
            label.setPrefSize(cellWidth, cellHeight);
            label.relocate(x * cellWidth + cellOffsetX, y * cellHeight + cellOffsetY);
        }
    }
}
 
源代码19 项目: kafka-message-tool   文件: UserGuiInteractor.java
private static Node getTextNodeContent(String content) {
    Label l = new Label();
    l.setText(content);
    l.setWrapText(true);
    return l;
}
 
源代码20 项目: exit_code_java   文件: Console.java
/**
 * A simple method for printing text to a terminal.
 * 
 * @param termArea The Label to print to.
 * 
 * @param text The String to print.
 */
public static void printText(Label termArea, String text) {
    termArea.setText(String.format("%s%n%s", termArea.getText(), text));
}