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

Shapes: Stroke invalid render after set style from runLater called from another thread

XMLWordPrintable

      Code to reproduce :
       
          @Override
          public void start(Stage stage) throws Exception {
              final String STYLE = "-fx-fill: green;"
                                           + "-fx-stroke: red;"
                                           + "-fx-stroke-width: 6;"
                                           + "-fx-stroke-type: inside;";
              BorderPane root = new BorderPane();
              final QuadCurve cubic1 = getCubic();
              final QuadCurve cubic2 = getCubic();
              cubic2.setStyle(STYLE);

              ScheduledExecutorService service = Executors.newScheduledThreadPool(1);
              service.schedule(new Runnable() {
                  @Override
                  public void run() {
                      Platform.runLater(new Runnable() {
                          @Override
                          public void run() {
                              cubic1.setStyle(STYLE);
                          }
                      });

                  }
              }, 5, TimeUnit.SECONDS);


              VBox panel = new VBox(30);
              panel.getChildren().addAll(new Button("Button"), cubic1, cubic2);
              root.setCenter(panel);
              Scene scene = new Scene(root, 600, 300);
              stage.setScene(scene);
              stage.setTitle(VersionInfo.getRuntimeVersion());
              stage.show();
          }

        1. after-set-focus-to-scene.png
          16 kB
          Sergey Lugovoy
        2. after-set-style.png
          16 kB
          Sergey Lugovoy

            kcr Kevin Rushforth
            slugovoy Sergey Lugovoy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: