Suboptimal method names in Text class

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Won't Fix
    • Priority: P3
    • fx2.0
    • Affects Version/s: fx2.0
    • Component/s: javafx
    • None

      If you want to set the font of a text you invoke the Text.setFont() method. That's easy to remember.
      If you want to set the wrapping width of a text you invoke the Text.setWrappingWidth() method. That's also easy to remember.

      All the property setting methods of the text class follow this simple naming pattern except for the following two methods:

      If you want to set the alignment of a text you cannot invoke a Text.setAlignment() method, and
      If you want to set the origin of a text you cannot invoke a Text.setOrigin() method.

      In these two cases you have to remember that these methods are called Text.setTextAlignment() and Text.setTextOrigin(), which is quite superfluous since there is no other alignment to a text but one, and there is no other origin to a text but one.

      This naming inconsistency makes the API less intuitive to use, and I suggest you change the method names to setAlignment() and setOrigin().

            Assignee:
            Philip Race
            Reporter:
            Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: