/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //package bugs; import javafx.application.Application; import javafx.geometry.VPos; import javafx.scene.Scene; import javafx.scene.layout.*; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.stage.Stage; public class TextFlowInGridPanelBug extends Application { final boolean SHOW_BUG = false; private final String textStr = "This is a very very very long long long very very very long long long line"; static public void main(String[] args) { launch(args); } @Override public void start(final Stage primaryStage) throws Exception { Pane redPane = new Pane(); redPane.setPrefSize(100, 100); // redPane.setMinSize(100, 100); // redPane.setMaxSize(100, 100); redPane.setStyle("-fx-background-color: #ff00007f"); final Font font = new Font(20); final Text text = new Text(textStr); text.setFont(font); final TextFlow flow = new TextFlow(text); final RowConstraints constraints = new RowConstraints(); constraints.setValignment(VPos.BASELINE); final GridPane gridPane = new GridPane(); gridPane.getRowConstraints().add(constraints); gridPane.add(flow, 0, 0); gridPane.add(redPane, 0, 1); gridPane.setStyle("-fx-background-color: LightGreen"); // final VBox container = new VBox(gridPane); final StackPane container = new StackPane(gridPane); container.setMaxWidth(200); container.setPrefHeight(400); primaryStage.setScene(new Scene(container)); primaryStage.show(); } }