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

Suboptimal method names in Text class

    XMLWordPrintable

    Details

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

      Description

      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().

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported: