Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8116047

Stage incorrectly sized when setResizable() is set to false in Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • Java 1.8.0ea b90

      When I create a non resizable stage that should be sized to the scene it appears too big on Windows when it is shown. It looks like the window borders change between a resizable and non resizable stage in Windows. The non resizable stage looks like it is too big by the difference in window border size.

      Run the supplied test case in Windows and notice the extra white background on the bottom and right sides of the stage. When you click on the blue rectangle the window resizes to the size it should have been shown at.


      ***********************************************************


      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.Pane;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;


      public class WindowTest extends Application {

      @Override public void start(final Stage primaryStage) throws Exception {


      Rectangle rect = new Rectangle(600, 400);
      rect.fillProperty().set(Color.DODGERBLUE);
      rect.setOnMouseClicked(new EventHandler<MouseEvent>() {
      @Override public void handle(MouseEvent event) {
      primaryStage.sizeToScene();
      }
      });

      primaryStage.setScene( new Scene(new Pane(rect)) );

      primaryStage.setResizable(false);
      primaryStage.sizeToScene();
      primaryStage.centerOnScreen();

      primaryStage.show();

      }

      public static void main(String[] args) throws Exception{
      launch(args);
         }

      }

            anthony Anthony Petrov (Inactive)
            csmithjfx Charles Smith (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: