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

Initial stage size set incorrectly for non-resizable stages

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      Java8b129, Win7, ATI Radeon HD 4600

      Description

      See the Stackoverflow question for a description, test case and work-around:
          http://stackoverflow.com/questions/20732100/javafx-why-does-stage-setresizablefalse-cause-additional-margins

      ----------

      Test code:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;
      import javafx.scene.Group;

      public class ResizableStageAutoSizingTest extends Application {

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

          @Override
          public void start(final Stage primaryStage) throws Exception {
              final Rectangle rectangle = new Rectangle(200, 100, Color.POWDERBLUE);

      // if you use a Group, the content is in the top left corner with a white margins to the right and bottom.
              final Scene scene = new Scene(new Group(rectangle));

      // if you use a BorderPane instead of a Group, the content is centered with a white margins on all sides.
      // final BorderPane pane = new BorderPane(rectangle);
      // final Scene scene = new Scene(pane);

      // if the stage is not resizable, it will be correctly sized.
      // primaryStage.setResizable(false);

              primaryStage.setScene(scene);

      // workaround to fix issue.
      // primaryStage.sizeToScene();

              primaryStage.show();
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                anthony Anthony Petrov (Inactive)
                Reporter:
                josmithjfx John Smith (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: