title: Repaint BorderPane (javaFx)
body: <p>I have an application that can create a rectangle that decreases in size for example a lapse of time of 10 sec, but here is when I try to shrink the rectangle, the window bug (nothing is displayed in the scene) and wait until the countdown is finished to stop bugging (and then display the rectangle not diminished).
  I tried to find on the Internet the equivalent of repaint in Swing but not average: /
  this.requestLayout () -> I found this on the internet but it does not work.
  Here is my code of my countdown:</p>
  
  <pre><code>public class Compteur {
  
      DemoBorderPane p ;
  
      public DemoBorderPane getPan() {
          if(p==null) {
              p = new DemoBorderPane();
          }
          return p;
      }
  
      public Compteur() {
  
      }
  
      public void lancerCompteur() throws InterruptedException {
  
  
         int leTempsEnMillisecondes=1000;
  
          for (int i=5;i&gt;=0;i--) {
              try {
                  Thread.sleep (leTempsEnMillisecondes);
              } 
              catch (InterruptedException e) {
                  System.out.print("erreur");
              }
              System.out.println(i);
              getPan().diminuerRect(35);
          }
      }
  }
  </code></pre>
  
  <p>There is my Borderpane code :</p>
  
  <pre><code>public class DemoBorderPane extends BorderPane {
  
      private Rectangle r;
  
      public Rectangle getRect() {
          if(r==null) {
              r = new Rectangle();
               r.setWidth(350);
                  r.setHeight(100);
                  r.setArcWidth(30);
                  r.setArcHeight(30);
                  r.setFill( //on remplie notre rectangle avec un dégradé
                          new LinearGradient(0f, 0f, 0f, 1f, true, CycleMethod.NO_CYCLE,
                              new Stop[] {
                                  new Stop(0, Color.web("#333333")),
                                  new Stop(1, Color.web("#000000"))
                              }
                          )
                      );
          }
  
          return r;
      }
  
      public void diminuerRect(int a) {
          getRect().setWidth(getRect().getWidth()-a);
          int c= (int) (getRect().getWidth()-a);
          System.out.println(c);
          this.requestLayout();
          //this.requestFocus();
      }
  
  
      public DemoBorderPane() {
          this.setBottom(getRect());
  
      }
  }
  </code></pre>
  
  <p>There is my Main code :</p>
  
  <pre><code>public class Main extends Application {
      private DemoBorderPane p;
  
      public DemoBorderPane getPan() {
          if(p==null) {
              p = new DemoBorderPane();
          }
          return p;
      }
  
      @Override
      public void start(Stage primaryStage) {
          Compteur c = new Compteur();
          try {
  
              //Group root = new Group();
              Scene scene = new Scene(getPan(),800,600);
              //scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
              //root.getChildren().add(getPan());
              primaryStage.setScene(scene);
              primaryStage.show();
  
  
  
          } catch(Exception e) {
              e.printStackTrace();
          }
  
          try {
              c.lancerCompteur();
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      public static void main(String[] args) {
  
          launch(args);
  
  
          /*Son s = null;
          try {
              s = new Son();
          } catch (LineUnavailableException | IOException | UnsupportedAudioFileException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          s.volume(0.1);
          s.jouer();
          c.lancerCompteur();
          s.arreter();*/
  
      }
  }
  </code></pre>
  
  <p>Thank ;)</p>