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

Mac: When width and height are set, setX and setY don't affect.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: javafx
    • Environment:

      MacOSx8, jdk8b66

      Description

      Run the code:

      import javafx.application.Application;
      import javafx.event.Event;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class JavaApplication4 extends Application {

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

          @Override
          public void start(final Stage stage) {
              Button b = new Button("Change coordinates");
                      
              b.setOnAction(new EventHandler(){

                  @Override
                  public void handle(Event t) {
                      Stage newStage = new Stage();
                      newStage.setWidth(100);//**
                      newStage.setHeight(100);//**
                      newStage.setX(stage.getX() + 50);
                      newStage.setY(stage.getY() + 50);
                      start(newStage);
                  }
              });
              
              VBox vb= new VBox();
              vb.getChildren().add(b);
              Scene scene = new Scene(vb);
              stage.setScene(scene);
              stage.show();
          }
      }

      Run the code, click button and look at how new stages appear at the same position. Remove lines marked with //**, and code will continue working as expexted.

        Attachments

          Activity

            People

            • Assignee:
              anthony Anthony Petrov (Inactive)
              Reporter:
              akirov Alexander Kirov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: