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

JTextPane needs several convenience methods of JTextArea

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6u10
    • client-libs

      A DESCRIPTION OF THE REQUEST :
      JTextPane is basically the same as JTextArea except that you can selectively style certain sections of the text.

      JTextArea has these convenience methods:
      getLineCount()
      getLineEndOffset(int line)
      getLineOfOffset(int offset)
      getLineStartOffset(int line)

      Why are the same methods not present in JTextPane? After all, it is basically the same class as JTextArea apart from styling, hence, you still have the same need for methods like the above.

      JUSTIFICATION :
      I work a l lot with lines in JTextPanes and am tired of having to write my own code to do those calculations.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Those methods to be present in JTextPane.
      ACTUAL -
      Methods absent.

      CUSTOMER SUBMITTED WORKAROUND :
      None, other than hand writing your own code, which you should not have to.

            peterz Peter Zhelezniakov
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: