/* * Copyright (c) 2012, 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.event.EventHandler; import javafx.scene.Parent; import javafx.scene.SceneBuilder; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Pane; import javafx.scene.layout.PaneBuilder; import javafx.stage.Stage; import javafx.stage.StageBuilder; /** * * @author Alexander Kouznetsov */ public class Bug extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage stage) throws Exception { StageBuilder.create() .scene(SceneBuilder.create() .root(getNode1()) .build()) .applyTo(stage); stage.show(); } private Parent getNode1() { return new Pane() { { getChildren().setAll( getNode2()); setOnMouseClicked(new EventHandler() { @Override public void handle(MouseEvent t) { System.out.println("computeMinHeight() = " + computeMinHeight(10)); System.out.println("computePrefHeight() = " + computePrefHeight(10)); System.out.println("computeMaxHeight() = " + computeMaxHeight(10)); } }); } }; } private Parent getNode2() { return PaneBuilder.create() .style("-fx-border-color: red; -fx-background-color: yellow; " + "-fx-border-radius: 10; -fx-background-radius: 10; " + "-fx-border-width: 3;") .minHeight(200) // .prefHeight(200) .maxHeight(200) .minWidth(200) // .prefWidth(200) .maxWidth(200) .build(); } }