/* * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ package bugs.richtext; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.scene.text.TextFlow; import javafx.stage.Stage; /** * * @author Andrey Glushchenko */ public class RichTextBoundsTestApp2 extends Application { private static int WIDTH = 500; private static int HEIGHT = 500; private static int FLOW_HEIGHT = 402; private static int FLOW_WIDTH = 402; @Override public void start(Stage stage) throws Exception { Pane root = new Pane(); root.setStyle("-fx-background-color: green;"); root.setPrefHeight(HEIGHT); root.setPrefWidth(WIDTH); root.setMinHeight(HEIGHT); root.setMinWidth(WIDTH); root.setMaxHeight(HEIGHT); root.setMaxWidth(WIDTH); TextFlow tf = new TextFlow(); tf.setStyle("-fx-border-color: red;-fx-background-color: white;"); tf.setPrefHeight(FLOW_HEIGHT); tf.setPrefWidth(FLOW_WIDTH); tf.setMinHeight(FLOW_HEIGHT - 30); tf.setMinWidth(FLOW_WIDTH - 30); tf.setMaxHeight(FLOW_HEIGHT + 30); tf.setMaxWidth(FLOW_WIDTH + 30); root.getChildren().add(tf); Rectangle rect = new Rectangle(); rect.setHeight(FLOW_HEIGHT + 25); rect.setWidth(100); rect.setFill(Color.AQUA); rect.setStroke(Color.BLUE); tf.getChildren().add(rect); Scene scene = new Scene(root, WIDTH, HEIGHT); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }