Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8100752

Suboptimal method names in Text class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P3 P3
    • fx2.0
    • fx2.0
    • 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().

            prr Philip Race
            risaksen Randahl Isaksen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: