-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
8
-
Win7, Java8b116
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;
}
}
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;
}
}