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

TextArea replaceRange() method behaviour is not consistent with previous release

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • client-libs
    • x86
    • windows_2000



      Name: dk106046 Date: 07/07/2003

      OPERATING SYSTEM(S):
      --------------------
      Windows 2000 with Service Pack 3

      FULL JDK VERSION(S):
      -------------------
      java version "1.4.2-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-rc-b23)
      Java HotSpot(TM) Client VM (build 1.4.2-rc-b23, mixed mode)


      ------------
      1. Compile test case Replace.java provided below.
          javac Replace.java

      2. Run the test case.
          java Replace

      3. Press the button labelled Replace.
             The character 'a' is deleted from the TextArea. This is not the expected behaviour.
      Would expect the character '9' to be deleted as happens when using Java builds 1.3.1_03-b03 and 1.4.1_02-b06


      /*
       * Replace.java
       */

      import java.awt.*;
      import java.awt.event.*;
                                                                                    
      public class Replace extends Frame {
          TextArea textArea;
          Button replace_Button;
                                                                                    
          public static void main(String args[]){
               Replace app= new Replace();
          } //end of main
                                                                                    
         public Replace(){
               super("replaceRange Test");
               setLayout(new BorderLayout());
               setFont( new Font("SanSerif", Font.PLAIN,14));
               setBackground(SystemColor.control );
                                                                                    
               setSize(320,280);
                                                                                    
               textArea = new TextArea("012\n456\n891abc\n", 8,30);
               replace_Button = new Button("Replace");
                                                                                    
               add("Center",replace_Button);
               add("South",textArea);
                                                                                    
               show();
                                                                                    
              addWindowListener( new WindowAdapter(){
                 public void windowClosing(WindowEvent e){
                   System.exit(0);
                 }
              });
                                                                                    
                                                                                    
              replace_Button.addActionListener(new ActionListener(){
                 public void actionPerformed(ActionEvent e){
                    textArea.replaceRange("", 9, 10);
                 }
              });
                                                                                                                                                                                                          
         }//end of Replace
      } //end of Replace Class

      [This bug is being submitted as a courtesy, in order to maintain uniformity between Sun & IBM JDKs. It has been fixed in IBM JDKs. Please contact ###@###.### if you have questions.]
      ======================================================================

            Unassigned Unassigned
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: