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

[SUSE Linux] Scene can shrink to 2-pixel size when it contains an empty group or a group which follows its size

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      SUSE Linux 11 64bit

      Description

      Scene can shrink to 2-pixel size when it contains an empty group or a non-empty group which resizes itself with changes to scene size (using ChangeListener or InvalidationListener).

      To reproduce, run the following application (you can modify it to try different cases):

      import javafx.application.Application;
      import javafx.beans.value.ChangeListener;
      import javafx.beans.value.ObservableValue;
      import javafx.scene.Scene;
      import javafx.scene.layout.Pane;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class Main extends Application {

          @Override
          public void start(Stage stage) {
              //Rectangle r = new Rectangle(100, 100, Color.ALICEBLUE);
              Pane box = new Pane();
              box.setStyle("-fx-border-color: red;");
              //box.getChildren().add(r);
              Scene scene = new Scene(box);
              
              scene.widthProperty().addListener(new ChangeListener<Number>() {
                  @Override
                  public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                      System.out.println("Scene width changed from " + t + " to " + t1);
                      //box.setPrefWidth((double) t1);
                  }
              });

              scene.heightProperty().addListener(new ChangeListener<Number>() {
                  @Override
                  public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                      System.out.println("Scene height changed from " + t + " to " + t1);
                      //box.setPrefHeight((double) t1);
                  }
              });
              
              stage.widthProperty().addListener(new ChangeListener<Number>() {
                  @Override
                  public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                      System.out.println("Stage width changed from " + t + " to " + t1);
                  }
              });

              stage.heightProperty().addListener(new ChangeListener<Number>() {
                  @Override
                  public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
                      System.out.println("Stage height changed from " + t + " to " + t1);
                  }
              });
              
              stage.setScene(scene);
              stage.setWidth(800);
              stage.setHeight(600);
              stage.sizeToScene();
              stage.show();
          }
      }

        Attachments

          Activity

            People

            Assignee:
            kcr Kevin Rushforth
            Reporter:
            ilatyshe Irina Grineva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: