1

Is there a way to bind text to a JavaFX shape (for my purposes, I want to use rectangles) the same way you could using Graphics2D's drawString in previous versions of Java?

You may be able to just use Graphics2D still; I just don't know how to implement it.

Note: What isn't helpful is a way to place a Text object at the same x and y position as the shape on canvas. Rather, is there a way to actually write onto the Rectangle?

  • possible duplicate of [JavaFX: How can I best place a Label centered in a Shape?](http://stackoverflow.com/questions/23258605/javafx-how-can-i-best-place-a-label-centered-in-a-shape) – James_D Dec 31 '14 at 20:31
  • Note you can also try just using a `Label` and adding some style with CSS to create a background color, padding, etc. – James_D Dec 31 '14 at 20:33

0 Answers0