title: JavaFX: how to clear the canvas
body: <p>Let's say I have drawn a rectangle on my canvas and I want to clean it in order to draw some other figure / polygon / arc ....</p>
  
  <p>How can I do it?  I have tried it in many ways but none has worked.</p>
  
  <p>I think this may work but I'm not sure:</p>
  
  <pre><code>GraphicsContext gc = myCanvas.getGraphicsContext2D();
  gc.setFill(Color.ALICEBLUE);
  gc.fillRect(0, 0, 300, 200);
  </code></pre>
  
  <p>Could you tell me if this will work consistently and whether it is the standard way to achieve this goal?</p>