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

JTextField scrolling to end or start of line takes extremely long time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 6
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP w/ SP2
      Windows 2003 w/ SP1

      A DESCRIPTION OF THE PROBLEM :
      When a JTextField is populated w/ a long string of text the amount of time required to scroll to the end or start of the string in the textfield using the END and HOME keys is directly related to the string length. If you paste the equivalent of 500 lines of text into the field it takes about 55s for the EventDispatchThread to return and the test program to become responsive again.

      The user can use arrow keys, and CTRL+ARROW key as well as CTRL+A to select all the text and delete it, but scrolling using HOME and END keys takes extremely long and blocks program until its completed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Copy a long string into the cut paste buffer
      2. Paste into a JTextField
      3. Use HOME key to scroll to beginning of test

      I used a LOG4J log file to simulated various lengths of text, using 100, 500, and 1000 lines of text to cut and paste into the JTextField.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      JTextField quickly scrolls to the beginning of the pasted string.
      ACTUAL -
      JTextField and running program become unresponsive while the operation is being processed.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class testScrollBug {

      public static void main( String[] args ) throws Exception {
                      JFrame frame = new JFrame();
      frame.getContentPane().setLayout( new FlowLayout() );
                      frame.getContentPane().add( new JTextField(25));
      frame.setSize( 400, 400 );
      frame.setVisible( true );
      }
      }
      ---------- END SOURCE ----------

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

              Created:
              Updated:
              Imported:
              Indexed: