Example usage for javafx.scene.text TextFlow TextFlow

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

Introduction

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

Prototype

public TextFlow(Node... children) 

Source Link

Document

Creates a TextFlow layout with the given children.

Usage

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();/*ww w. j a v a2  s  .  c o m*/
        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);
    }
}

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   www. ja v a 2s . 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);
    }
}