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

Enhance Text and TextFlow to allow specifying different caret shapes

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      Both Text and TextFlow (both in the javafx.scene.text package) allow us to get a caret shape. The former does this with the "caretShape" property while both have a "caretShape(int,boolean)" method. However, this always returns a vertical bar caret. I believe it would be useful to have different caret shapes (e.g. to indicate whether the user is in "insert mode" or not, or to simply allow more user customization).

      I'm only aware of three common caret shapes: vertical bar, solid rectangle, and underscore. This could be implemented with an enum and possibly be a property in Text and an overload of "caretShape(int,boolean)" in both Text and TextFlow (where the default would be a vertical bar). For example:

      public enum CaretShape {
        VERTICAL_BAR,
        SOLID_RECTANGLE,
        UNDERSCORE;
      }

      Note the above is just an idea. If there are more idiomatic names those should be used instead. Also, if there's a way to allow developers to define their own caret shapes (possibly with the above three as built-ins) that might be better.


        Attachments

          Activity

            People

            • Assignee:
              prr Philip Race
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: