Pane.setPadding() wrongly affects to another pane

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • None
    • Affects Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      Windows 7 64bit
      jre 7
      JavaFX 2.0_b32

      I consider that improper behavior appears when Pane with insets contains another Pane.

      Minimal code below

      //////////////////////////////////////////
      import javafx.application.Application;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.layout.HBox;
      import javafx.scene.layout.Pane;
      import javafx.stage.Stage;

      public class ShortApp extends Application {

          public static void main(String[] args) {
              Application.launch(ShortApp.class, args);
          }
          
          @Override
          public void start(Stage primaryStage) {
              
              primaryStage.setTitle("Hello World");
              
              Pane mainContainer = new Pane();
              mainContainer.setPrefSize(450, 350);
              mainContainer.setPadding(new Insets(25));
              
              HBox pane = new HBox();
              pane.alignmentProperty().set(Pos.CENTER);
              pane.setStyle("-fx-border-color: red;");
              pane.setPrefSize(400, 300);
              
              mainContainer.getChildren().add(pane);

              primaryStage.setScene(new Scene(mainContainer));
              
              primaryStage.setVisible(true);
          }
      }
      /////////////////////////////////////////////////////

      I awaited that inner pane will be located with insets from all four directions (top, bottom, left, right) of outer pane as written in docs.
      But in fact pane glues to upper-left corner.

            Assignee:
            Anne Fowler (Inactive)
            Reporter:
            Anatoliy Tyukpiekov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: