Example usage for javafx.scene.control Label setWrapText

List of usage examples for javafx.scene.control Label setWrapText

Introduction

In this page you can find the example usage for javafx.scene.control Label setWrapText.

Prototype

public final void setWrapText(boolean value) 

Source Link

Usage

From source file:Main.java

public static void executeWithProgressDialogInBackground(final Runnable runnable, final StackPane target,
        final String text) {
    Thread th = new Thread() {
        @Override/* w ww.  ja v a2  s. c  om*/
        public void run() {
            final Node progressIndicator = createProgressIndicator();
            final Label label = new Label(text);
            try {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        target.getChildren().add(progressIndicator);
                        label.setWrapText(true);
                        target.getChildren().add(label);
                    }
                });
                runnable.run();
            } finally {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        target.getChildren().remove(progressIndicator);
                        target.getChildren().remove(label);
                    }
                });
            }
        }
    };
    th.setDaemon(true);
    th.start();
}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private static void addName(final HBox content, final BookingBean be) {
    final Label label = new Label(be.getGuest().getName() + "\n" + be.getBookingOrigin().getName());
    label.setWrapText(true);
    content.getChildren().add(label);//from  www.  jav a 2  s  .c  om
    HBox.setHgrow(label, Priority.ALWAYS);

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Label Sample");
    stage.setWidth(400);/*w  ww  .  j  a v  a 2s.c o m*/
    stage.setHeight(180);

    HBox hbox = new HBox();

    Label label1 = new Label("Search long long long long long long long long long ");
    label1.setPrefWidth(100);
    label1.setWrapText(true);

    hbox.setSpacing(10);
    hbox.getChildren().add((label1));
    ((Group) scene.getRoot()).getChildren().add(hbox);

    stage.setScene(scene);
    stage.show();
}

From source file:com.panemu.tiwulfx.control.DetailPanel.java

private void generateUI() {
    this.getChildren().removeAll(this.getChildren());
    for (String prop : propertyNames) {
        LabelSeparator labelSeparator = new LabelSeparator("");
        labelSeparator.setText(prop);//from w  ww  .  j  a va 2  s  .c om
        VBox.setMargin(labelSeparator, new Insets(10, 0, 0, 0));
        this.getChildren().add(labelSeparator);
        Label lblValue = new Label();
        lblValue.getStyleClass().add("valueLabel");
        lblValue.setWrapText(true);
        this.getChildren().add(lblValue);

        componentMap.put(prop, lblValue);
    }
}

From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java

private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList,
        List<Country> dataProvider) {
    Label label = addLabel(gridPane, ++gridRow, title, 0);
    label.setWrapText(true);
    label.setMaxWidth(180);//from  w  w  w  .ja  v a 2s . c o  m
    label.setTextAlignment(TextAlignment.RIGHT);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    flowPane.setMinHeight(55);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    dataProvider.stream().forEach(country -> {
        final String countryCode = country.code;
        CheckBox checkBox = new CheckBox(countryCode);
        checkBox.setUserData(countryCode);
        checkBoxList.add(checkBox);
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setMinWidth(45);
        checkBox.setMaxWidth(45);
        checkBox.setTooltip(new Tooltip(country.name));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                sepaAccount.addAcceptedCountry(countryCode);
            else
                sepaAccount.removeAcceptedCountry(countryCode);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    updateCountriesSelection(isEditable, checkBoxList);

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}

From source file:com.panemu.tiwulfx.control.DetailPanel.java

private void displayValues() {
    for (String prop : propertyNames) {
        try {/*from  ww w  . j a  v a 2  s  . c o  m*/
            Label lblValue = componentMap.get(prop);
            Object obj = PropertyUtils.getSimpleProperty(objectToDisplay, prop);
            if (obj != null) {
                /**
                 * There is a bug in Label control. When the text's length
                 * is 1 and the wrapText property is true, the label display
                 * nothing. Workaround, don't wrap is the text's length is 1
                 */
                if (obj.toString().length() == 1) {
                    lblValue.setWrapText(false);
                }

                lblValue.setText(obj.toString());
            } else {
                lblValue.setText("-- undefined --");
            }
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
            throw new RuntimeException(ex.getMessage());
        }
    }
}

From source file:gov.va.isaac.gui.refexViews.refexEdit.AddRefexPopup.java

public void finishInit(RefexDynamicGUI refexToEdit, DynamicRefexView viewToRefresh) {
    callingView_ = viewToRefresh;//from   w ww  . ja  v a2 s .c om
    createRefexFocus_ = null;
    editRefex_ = refexToEdit;

    title_.setText("Edit existing sememe instance");

    gp_.add(unselectableComponentLabel_, 1, 1);
    unselectableComponentLabel_.setText(OTFUtility.getDescription(editRefex_.getRefex().getAssemblageNid()));

    //don't actually put this in the view
    selectableConcept_.set(OTFUtility.getConceptVersion(editRefex_.getRefex().getReferencedComponentNid()));

    Label refComp = new CopyableLabel(
            OTFUtility.getDescription(editRefex_.getRefex().getReferencedComponentNid()));
    refComp.setWrapText(true);
    AppContext.getService(DragRegistry.class).setupDragOnly(refComp, () -> {
        return editRefex_.getRefex().getReferencedComponentNid() + "";
    });
    gp_.add(refComp, 1, 0);
    refexDropDownOptions.clear();
    try {
        assemblageInfo_ = RefexDynamicUsageDescriptionBuilder
                .readRefexDynamicUsageDescriptionConcept(editRefex_.getRefex().getAssemblageNid());
        assemblageIsValid_.set(true);
        buildDataFields(true, editRefex_.getRefex().getData());
    } catch (Exception e) {
        logger_.error("Unexpected", e);
        AppContext.getCommonDialogs().showErrorDialog("Unexpected Error reading Assembly concept", e);
    }
}

From source file:gov.va.isaac.gui.refexViews.refexEdit.AddSememePopup.java

public void finishInit(SememeGUI refexToEdit, SememeView viewToRefresh) {
    callingView_ = viewToRefresh;//from  ww w  . j  a v  a  2  s.c o m
    createRefexFocus_ = null;
    editRefex_ = refexToEdit;
    st_ = refexToEdit.getSememe().getChronology().getSememeType();

    title_.setText("Edit existing sememe instance");

    gp_.add(unselectableComponentLabel_, 1, 1);
    unselectableComponentLabel_
            .setText(Get.conceptDescriptionText(editRefex_.getSememe().getAssemblageSequence()));

    //TODO this assuming that the referenced component is a concept,  which I don't think is a safe assumption.

    //don't actually put this in the view
    selectableConcept_.set(new SimpleDisplayConcept(editRefex_.getSememe().getReferencedComponentNid()));

    Label refComp = new CopyableLabel(
            Get.conceptDescriptionText(editRefex_.getSememe().getReferencedComponentNid()));
    refComp.setWrapText(true);
    AppContext.getService(DragRegistry.class).setupDragOnly(refComp, () -> {
        return editRefex_.getSememe().getReferencedComponentNid() + "";
    });
    gp_.add(refComp, 1, 0);
    refexDropDownOptions.clear();
    try {
        assemblageInfo_ = DynamicSememeUsageDescription
                .mockOrRead(((SememeVersion<?>) editRefex_.getSememe()).getChronology());
        assemblageIsValid_.set(true);
        buildDataFields(true, SememeGUI.getData(editRefex_.getSememe()));
    } catch (Exception e) {
        logger_.error("Unexpected", e);
        AppContext.getCommonDialogs().showErrorDialog("Unexpected Error reading Assembly concept", e);
    }
}

From source file:com.core.meka.SOMController.java

private void initPopovers() {
    patronesEntrenamientoPopover = new PopOver();

    StackPane pane = new StackPane();
    BorderPane b = new BorderPane();
    b.setPadding(new Insets(10, 20, 10, 20));
    VBox vbox = new VBox();
    Label title = new Label("Configuracion correcta");
    Label content = new Label("Aqui un ejemplo de configuracion");
    Label content1 = new Label("de patrones de entrenamiento de dimension 2");
    content.setPadding(new Insets(5, 0, 0, 0));
    content1.setPadding(new Insets(5, 0, 0, 0));
    content.setWrapText(true);
    vbox.getChildren().addAll(title, content, content1, new ImageView(new Image("/img/config1.png")));
    b.setCenter(vbox);//from   ww  w  .  j a  va  2 s. c o  m

    patronesEntrenamientoPopover.setContentNode(b);
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param iLargeur/* ww w . j  ava  2s . c  o m*/
 * @param iHauteur
 * @param bMasqueZones
 * @param strIdZone
 * @param mouseEvent
 */
private static void choixZone(int iLargeur, int iHauteur, boolean bMasqueZones, String strIdZone,
        MouseEvent mouseEvent) {
    ComboBox cbTouchesBarre = new ComboBox();
    cbTouchesBarre.getItems().clear();
    for (int i = 0; i < strTouchesBarre.length; i++) {
        cbTouchesBarre.getItems().add(i, strTouchesBarre[i]);
    }
    cbTouchesBarre.setLayoutX(200);
    cbTouchesBarre.setLayoutX(40);

    final int iNumeroZone = Integer.parseInt(strIdZone.split("-")[1]);
    if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
        if (mouseEvent.getClickCount() == 2) {
            for (int ij = iNumeroZone; ij < iNombreZones - 1; ij++) {
                zones[ij] = zones[ij + 1];
            }
            iNombreZones--;
            afficheBarrePersonnalisee(iLargeur, iHauteur, bMasqueZones);
        } else {
            afficheBarrePersonnalisee(iLargeur, iHauteur, bMasqueZones);
            apZoneBarrePersonnalisee.getChildren().clear();
            apZoneBarrePersonnalisee.getChildren().add(cbTouchesBarre);
            ZoneTelecommande zone = zones[iNumeroZone];
            int index = -1;
            for (int ij = 0; ij < strCodeBarre.length; ij++) {
                if (strCodeBarre[ij].equals(zone.getStrIdZone())) {
                    index = ij;
                }
            }
            if (index != -1) {
                cbTouchesBarre.getSelectionModel().select(index);
            }

            cbTouchesBarre.valueProperty().addListener((ov, ancienneValeur, nouvelleValeur) -> {
                if (nouvelleValeur != null) {
                    String strId = strCodeBarre[cbTouchesBarre.getSelectionModel().getSelectedIndex()];
                    zones[iNumeroZone].setStrIdZone(strId);
                }
            });

            Label lblTypeBarre = new Label(zone.getStrTypeZone());
            lblTypeBarre.setLayoutX(20);
            lblTypeBarre.setLayoutY(40);
            Label lblCoordsBarre = new Label(zone.getStrCoordonneesZone());
            lblCoordsBarre.setLayoutX(20);
            lblCoordsBarre.setLayoutY(70);
            lblCoordsBarre.setPrefWidth(260);
            lblCoordsBarre.setMaxWidth(260);
            lblCoordsBarre.setWrapText(true);
            apZoneBarrePersonnalisee.getChildren().addAll(lblTypeBarre, lblCoordsBarre);
            switch (zone.getStrTypeZone()) {
            case "poly":
                Polygon poly = (Polygon) apImgBarrePersonnalisee.lookup("#" + strIdZone);
                poly.setFill(Color.rgb(255, 0, 0, 0.5));
                poly.setStroke(Color.YELLOW);
                apImgBarrePersonnalisee.getChildren()
                        .addAll(olCreeAncresPourPolygone(iNumeroZone, poly.getPoints()));
                break;
            case "rect":
                Rectangle rect = (Rectangle) apImgBarrePersonnalisee.lookup("#" + strIdZone);
                rect.setFill(Color.rgb(255, 0, 0, 0.5));
                rect.setStroke(Color.YELLOW);
                apImgBarrePersonnalisee.getChildren().addAll(olCreeAncresPourRectangle(iNumeroZone, rect));
                break;
            case "circle":
                Circle cercle = (Circle) apImgBarrePersonnalisee.lookup("#" + strIdZone);
                cercle.setFill(Color.rgb(255, 0, 0, 0.5));
                cercle.setStroke(Color.YELLOW);
                apImgBarrePersonnalisee.getChildren().addAll(olCreeAncresPourCercle(iNumeroZone, cercle));
                break;
            }

        }
    }

}