title: How add text in Rectangle in Javafx
body: <p>How do I add a text at the center of a rectangle? I've been searching and have not found a way to do this.</p>
  
  <p>See the class below: </p>
  
  <pre><code>public class Agent extends Rectangle{         
  
      public Agent() {
          setWidth(60);
          setHeight(60);
          setArcWidth(60);
          setArcHeight(60);                
          setFill(Color.BLUEVIOLET.deriveColor(0, 1.2, 1, 0.6));
          setStroke(Color.BLUEVIOLET);
       }    
  }
  </code></pre>
  
  <p>Thanks!</p>