Issue
My problem is that when I use setResizable(false) one white border is shown on my scene. When I don't set it false works fine, but I need to set it false.
Code:
Scene scene = new Scene(new StackPane());
LoginManager loginManager = new LoginManager(scene);
loginManager.showLoginScreen();
primaryStage.setResizable(false);
primaryStage.setScene(scene);
primaryStage.show();
My ImageView is inside of my AnchorPane
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="900.0" xmlns:fx="http://javafx.com/fxml" fx:controller="br.com.facilit.target.app.desktop.view.MainViewController">
<children>
<ImageView id="background" fitHeight="600.0" fitWidth="900.0" pickOnBounds="true">
<image>
<Image url="@../images/background.jpg" preserveRatio="true" smooth="true" />
</image>
Solution
I had the same issue, I resolved in this way:
primaryStage.setScene(scene);
primaryStage.setWidth(900);
primaryStage.setHeight(600);
primaryStage.setResizable(false);
primaryStage.show();
You have to set the scene before setting the resizable property and set the width/height manually. This has solved my problem.
Answered By - Alberto
Answer Checked By - Terry (JavaFixing Volunteer)