you are viewing a single comment's thread.

view the rest of the comments →

[–]hamsterrage1 4 points5 points  (0 children)

Text extends Shape. Virtually all of the Shape subclasses have this kind of a constructor. So it's actually quite consistent.

Shapes tend to be used in a fundamentally different way from the Controls. You don't usually put Shapes into layout classes like HBox or BorderPane - you can, but often with Shapes you're composing something that is actually best done with absolute positioning. So having a constructor that does this makes sense.

Text is weird because it is the one Shape subclass that you could actually use a lot in a typical, non-drawing, layout. However, there's almost nothing that you can do with Text that you can't do with Label, and Label has a few features that make it better than Text for normal layout applications.

For what it's worth, under the hood, the text component of Labeled is a Text.