Example usage for javafx.stage Stage setMaxHeight

List of usage examples for javafx.stage Stage setMaxHeight

Introduction

In this page you can find the example usage for javafx.stage Stage setMaxHeight.

Prototype

public final void setMaxHeight(double value) 

Source Link

Usage

From source file:sudoku.controller.GameController.java

@Override
public void start(Stage primaryStage) throws Exception {
    getBoardReady();//from   www .  j av a2s .  c o  m

    //when the one of the level button is clicked

    //easy
    sudokuBoard.getEasyButton().setOnAction(e -> {
        try {
            viewController.newGrid(GameController.userBoard, GameController.solutionBoard,
                    sudokuBoard.getTextAreas(), 0);
        } catch (IOException ex) {
            System.out.println("Invalid easy file");
        } catch (ParseException ex) {
            System.out.println("Invalid format in easy file");
        }
    });

    //medium
    sudokuBoard.getMediumButton().setOnAction(e -> {
        try {
            viewController.newGrid(GameController.userBoard, GameController.solutionBoard,
                    sudokuBoard.getTextAreas(), 1);
        } catch (IOException ex) {
            System.out.println("Invalid medium file");
        } catch (ParseException ex) {
            System.out.println("Invalid format in medium file");
        }
    });

    //hard
    sudokuBoard.getHardButton().setOnAction(e -> {
        try {
            viewController.newGrid(GameController.userBoard, GameController.solutionBoard,
                    sudokuBoard.getTextAreas(), 2);
        } catch (IOException ex) {
            System.out.println("Invalid hard file");
        } catch (ParseException ex) {
            System.out.println("Invalid format in hard file");
        }
    });

    Scene scene = new Scene(sudokuBoard.getMainScene(), SIZE, SIZE);
    primaryStage.setScene(scene);
    //fixed dimensions for the board 
    primaryStage.setMaxHeight(SIZE);
    primaryStage.setMaxWidth(SIZE);
    primaryStage.setMinHeight(SIZE);
    primaryStage.setMinWidth(SIZE);

    primaryStage.show();
}

From source file:snpviewer.SnpViewer.java

private void fixStageSize(Stage stage, boolean fix) {
    /*provides a fix for annoying bug which means that 
     * setResizable(false) causing windows to grow in size in Windows
     *///from  w w  w.  j a  va2s  . c o  m
    if (fix) {
        stage.setMaxHeight(stage.getHeight());
        stage.setMinHeight(stage.getHeight());
        stage.setMaxWidth(stage.getWidth());
        stage.setMinWidth(stage.getWidth());
    } else {
        Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
        stage.setMaxHeight(primaryScreenBounds.getHeight());
        stage.setMinHeight(300);
        stage.setMaxWidth(primaryScreenBounds.getWidth());
        stage.setMinWidth(500);
    }
}