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

getSelectedText, getSelectedStart/End in TextArea class returns wrong

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5
    • client-libs
    • None
    • x86, sparc
    • solaris_2.6, windows_95, windows_nt



      Name: sg39081 Date: 08/15/97


      The following is in one of my program. When this code is applied
      on the first line of the TextArea, everything works fine. But
      on the second line, it returns the selection one character after
      whatever was marked. On the third line, it returns the selection,
      two characters afterward. And so on for each line down.

        TextArea text = new TextArea (20, 10);
        String str = new String (text.getSelectedText ());

        str = str.toUpperCase ();
        text.replaceRange (str,
                           text.getSelectionStart (),
                           text.getSelectionEnd ());

      I speculate that Windows' multi-line entry field generates
      CR/LF at the end-of-line, which is two characters, while
      JDK does not take that into account.

      company - Cynosure.X International , email - ###@###.###
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            sgoodsunw Sheri Good (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: