/*
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 */
package helloworld;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region;
import javafx.stage.Stage;

/**
 * @author jcambon
 */
public class TestNegativeHeight extends Application {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Application.launch(args);
    }

    @Override
    public void start(Stage stage) {
        stage.setTitle("Hello Button");
        AnchorPane root = new AnchorPane();
//        root.setStyle("-fx-background-color: green;");
        Scene scene = new Scene(root, 600, 450);

        final Button button = new Button();
        button.setText("Click Me");
        button.setLayoutX(25);
        button.setLayoutY(40);
        button.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent e) {
                button.setPrefHeight(Double.NEGATIVE_INFINITY);
                button.setMinHeight(Region.USE_PREF_SIZE);
            }
        });


        root.getChildren().add(button);

        stage.setScene(scene);
        stage.show();
    }
}