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

Scene Width and Height, if not specified, result in no window being shown

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • javafx
    • None

      It is possible to create a Scene without specifying the width or height. If the scene has no intrinsic size (for example, if an empty group was specified as the content of the scene), then no window is shown. Instead, we should pick some size by default in such situations so that the window is at least shown. I would suggest a 320x200 default size. Any display in the last two decades will be able to show it, including most (all?) embedded screens we're targeting.


      public class StartupApp extends Application {

          @Override
          public void start(Stage stage) throws Exception {
              Scene scene = new Scene(new Group(), Color.FLORALWHITE);
              stage.setScene(scene);
              stage.show();
          }

          /**
           * Java main for when running without JavaFX launcher
           */
          public static void main(String[] args) {
              launch(args);
          }
      }

            anthony Anthony Petrov (Inactive)
            rbair Richard Bair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: