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

Changing BorderPane contraints (adding and removing same component) causes component to disappear

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5
    • 8
    • fx2.0
    • javafx
    • release beta build 42 - 32 bit
      windows 7 - Home Premium 64 bits

    Description

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.paint.Color;
      import javafx.stage.Stage;
       
      public class MainWindow extends Application {
       
      public static void main(String[] args) {
      Application.launch(args);
      }
       
      public void start(Stage s) {
      BorderPane workArea = new BorderPane();
       
      Button button = new Button("where am i?");
       
      Scene scene = new Scene(workArea, 800, 600, Color.TRANSPARENT);
      s.setScene(scene);
      s.show();
       
      workArea.setCenter(button);
      workArea.getChildren().remove(button);
      workArea.setLeft(button);
      workArea.getChildren().remove(button);
      workArea.setCenter(button);
      }
       

      Expected behavior:

      Control "button" should be visible on the center position of the BorderPane

      Current behavior:

      "button" isn't visible after running the snippet

      Workaround:

      Remove the component with setTop(null)/setCenter(null) or wherever the component the was

      Attachments

        Activity

          People

            msladecek Martin Sládeček
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: