/* * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. */ import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.SplitPane; import javafx.scene.control.Button; import javafx.scene.layout.FlowPane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; import javafx.stage.Stage; /** * * @author Alexander Kouznetsov */ public class Bug extends Application { /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { Button button = new Button("Button"); Rectangle rectangle = new Rectangle(100, 100, Color.RED); FlowPane flow = new FlowPane(); flow.getChildren().setAll(rectangle); SplitPane root = new SplitPane(); root.getItems().setAll(button, flow); Scene scene = new Scene(root, 400, 300); stage.setScene(scene); stage.show(); System.out.println("button.minWidth = " + button.minWidth(-1)); System.out.println("flow.minWidth = " + flow.minWidth(-1)); System.out.println("button.prefWidth = " + button.prefWidth(-1)); System.out.println("flow.prefWidth = " + flow.prefWidth(-1)); } }