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

ScrollPane content.getParent() returns null

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      Win7, Java8b116

      Description

      When setting the content on a scrollpane, content.getParent() returns null as long as the stage is not visible - see test below.

      public class ScrollPaneContentParentTest extends Application
      {
        private Pane scrollContent;
        
        public static void main(String[] args)
        {
          Application.launch(args);
        }

        @Override
        public void start(Stage stage)
        {
          Parent root = createContent();
          System.err.println("Parent (shouldn't be null): " + scrollContent.getParent());
          Scene scene = new Scene(root, 500, 500);
          stage.setScene(scene);
          stage.show();
          System.err.println("Parent: " + scrollContent.getParent());
        }
        
        private Parent createContent()
        {
          ScrollPane scroller = new ScrollPane();
          scrollContent = new FlowPane(10,10);
          scrollContent.setPrefSize(500, 2000);
          Button button = new Button("MyButton");
          scrollContent.getChildren().add(button);
          scroller.setContent(scrollContent);
          return scroller;
        }
      }

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              wzberger Wolfgang Zitzelsberger
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: