JDK-4700544 : REGRESSION: down-arrow fails in wrapped JTextArea above empty line
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2002-06-11
  • Updated: 2002-06-12
  • Resolved: 2002-06-12
Related Reports
Duplicate :  
Description

Name: jk109818			Date: 06/11/2002


FULL PRODUCT VERSION :
v:\>java -version
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

ADDITIONAL OPERATING SYSTEMS :
Linux 2.4.18 #4


A DESCRIPTION OF THE PROBLEM :
If you have a JTextArea with setLineWrap(true), and position
the caret in a non-wrapped line above an empty line,
cursor-down does not move the caret down.
Instead, the caret stays where it is.

The attached program demonstrates this.

Java 1.3.1 behaved correctly.

It seems to be the fault of the View, because with
setLineWrap(false) it works.

If the line in question is wrapped, it works.

If you don't edit the non-empty line, it works.

If the line below the line you edit isn't empty, it works.



REGRESSION.  Last worked in version 1.3.1

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and run the attached program (no arguments).
2. Follow the instructions in the JTextArea.


EXPECTED VERSUS ACTUAL BEHAVIOR :
The caret should move on to the empty line.
It doesn't; it stays on the newly-edited line.

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

public class JTextAreaBug {
	public static void main(String[] args) {
		JFrame f = new JFrame("JTextArea bug demo");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JTextArea textArea = new JTextArea(
            "Expand this window so that none of the text wraps.\n" +
            "Click somewhere on this line, type something, then press cursor-
down.\n" +
            "\n" +
            "You'd hope to find the caret on the blank line, but it doesn't
move...\n" +
            "If you narrow the window so the line wraps, cursor-down will
work.\n" +
            "If you comment out the call to setLineWrap(true), cursor-down will
work.\n" +
            "If you type some text on the currently empty line, cursor-down
will work.");
		textArea.setLineWrap(true);
		f.getContentPane().add(new JScrollPane(textArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
		f.setSize(new Dimension(480, 300));
		f.setVisible(true);
	}
}

---------- END SOURCE ----------

CUSTOMER WORKAROUND :
None known.

Release Regression From : 1.3.1_03
The above release value was the last known release where this 
bug was known to work. Since then there has been a regression.

(Review ID: 153473) 
======================================================================