Example usage for javafx.scene.text TextFlow setMinWidth

List of usage examples for javafx.scene.text TextFlow setMinWidth

Introduction

In this page you can find the example usage for javafx.scene.text TextFlow setMinWidth.

Prototype

public final void setMinWidth(double value) 

Source Link

Usage

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private void insertConfigItemsIntoGrid(final GridPane gp, final List<Triple<String, Node, String>> formItems) {
    for (int i = 0; i < formItems.size(); i++) {
        final String title = formItems.get(i).getLeft();
        final Node inputElement = formItems.get(i).getMiddle();
        final String description = formItems.get(i).getRight();

        // Put text flow object into cell. If a Text instance is used only, it will grab the whole cell size and center the text
        // (horizontally and vertically). Therefore, the table cell alignment does not work.
        final TextFlow titleText = new TextFlow(new Text(title));
        titleText.setStyle("-fx-font-weight: bold;");
        final TextFlow fieldName = new TextFlow(titleText);
        fieldName.autosize();//from ww  w  . j  a  va 2  s .  co m
        fieldName.setMinWidth(fieldName.getWidth());
        gp.add(fieldName, 0, i);
        final Text descriptionText = new Text(description);
        final VBox vbox = new VBox(inputElement, new TextFlow(descriptionText));
        gp.add(vbox, 1, i);
    }
}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

private void insertConfigItemsIntoGrid(final GridPane gp, final List<Triple<String, Node, String>> formItems) {
    for (int i = 0; i < formItems.size(); i++) {
        final String title = formItems.get(i).getLeft();
        final Node inputElement = formItems.get(i).getMiddle();
        final String description = formItems.get(i).getRight();

        // Put text flow object into cell. If a Text instance is used only, it will grab the whole cell size and center the text
        // (horizontally and vertically). Therefore, the table cell alignment does not work.
        final TextFlow titleText = new TextFlow(new Text(title));
        titleText.setStyle("-fx-font-weight: bold;");
        final TextFlow fieldName = new TextFlow(titleText);
        fieldName.autosize();/*from w  w  w  .j  a va2 s .  com*/
        fieldName.setMinWidth(fieldName.getWidth());
        gp.add(fieldName, 0, i);
        final VBox vbox = new VBox(inputElement);
        if (StringUtils.isNotBlank(description)) {
            vbox.getChildren().add(new TextFlow(new Text(description)));
        }
        gp.add(vbox, 1, i);
    }
}