0 Replies Latest reply on Jul 2, 2020 3:27 PM by DeepakP1987

    Widgets on FXCanvas doesnt display

    DeepakP1987

      I am trying to write an application in eclipse. So as to use javafx components on components am using the FXCanvas. So the problem is i try the below program which creates around 500 nodes, the composite is empty. And none of the nodes are displayed.

       

      But instead of 500 nodes, if we create 50 nodes, then the nodes are visible in the SWT Composite.

       

      What is the problem here ?

       

      FXCanvas canvas = new FXCanvas(swtComposite, SWT.NONE) {

       

            @Override

            public Point computeSize(final int wHint, final int hHint, final boolean changed) {

              getScene().getWindow().sizeToScene();

              int width = (int) getScene().getWidth();

              int height = (int) getScene().getHeight();

              return new Point(width, height);

            }

          };

       

       

          Group group = new Group();

          Scene scene = new Scene(group);

       

          canvas.setScene(scene);

       

          VBox container = new VBox();

          ScrollPane root = new ScrollPane(container);

          root.setContent(container);

       

          for (int i = 0; i < 500; i++) {

            container.getChildren().add(new Button("Hello_" + i));

          }

          group.getChildren().add(container);