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

AccessibleAWTTextComponent.getSelectedText() returns "" instead null.

    Details

    • Subcomponent:
    • Resolved In Build:
      b26
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.5.1
    • Verification:
      Verified

      Description



      Name: aaC67449 Date: 07/23/99



      The TextComponent.AccessibleAWTTextComponent.getSelectedText() returns empty
      string instead of null, when there is no selection.

      The javadoc says:"
      public String getSelectedText()

            Returns the portion of the text that is selected.
            Specified by:
                  getSelectedText in interface AccessibleText
            Returns:
                  the text, null if no selection

      "

      See example.
      ------------- example --------------
      import java.awt.*;
      import javax.accessibility.*;

      public class Test {

         public static void main(String argv[]) {

             TextField o=new TextField("Test1");
             AccessibleText c = o.getAccessibleContext().getAccessibleText();
             if (c.getSelectedText()!=null) {
                 System.out.println("Failed. Method returns:\""
                         +c.getSelectedText()+"\"");
             } else {
      System.out.println("Passed");
             }
         }

      }
      ------------- JDK1.3L output ---------------
      Warning: JIT compiler "sunwjit" not found. Will use interpreter.
      Failed. Method returns:""

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              prssunw Prs Prs (Inactive)
              Reporter:
              alisunw Ali Ali (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: