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

Pane.setPadding() wrongly affects to another pane

    XMLWordPrintable

    Details

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

      Windows 7 64bit
      jre 7
      JavaFX 2.0_b32

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported: