Example usage for javafx.scene.layout StackPane setMaxSize

List of usage examples for javafx.scene.layout StackPane setMaxSize

Introduction

In this page you can find the example usage for javafx.scene.layout StackPane setMaxSize.

Prototype

public void setMaxSize(double maxWidth, double maxHeight) 

Source Link

Document

Convenience method for overriding the region's computed maximum width and height.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    StackPane stack = new StackPane();
    stack.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    stack.getChildren().addAll(new Rectangle(100, 100, Color.BLUE));

    group.getChildren().add(stack);//from  w ww.j a v  a2  s . c om

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}