JDK-4785160 : It's possible to make cursor invisible when typing in JTextArea with JScrollBar
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1,5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2002-11-26
  • Updated: 2022-09-16
  • Resolved: 2022-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Description

Name: jk109818			Date: 11/26/2002


FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

FULL OPERATING SYSTEM VERSION :

Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
There is a JTextArea inside JScrollPane. If you are typing
into JTextArea then cursor becomes invisible just after
horisontal scrollbar appears. The typed text is visible (it
is shifted to the left) but cursor is not. Definetely it
should. This is reproducible at least under Windows and
Metal LookAndFeels. Under CDE/Motif only a small part of
cursor is visible.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile and launch the attached example.
2. Put focus into text aread and srart typing until
horizontal scrollbar appears.
3. Just after apparing of scroll bar the cursor becomes
invisible.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: Cursor must be visible all the time you are typing
into text area.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.*;

/**
 * @author Vladimir Kondratyev
 */
public class Test {
  public static void main(String[] args){
    JFrame frame=new JFrame("Example");
    frame.setBounds(100,100,200,200);
    frame.addWindowListener(
      new WindowAdapter(){
        public void windowClosing(WindowEvent e){
          System.exit(0);
        }
      }
    );

    frame.getContentPane().setLayout(new BorderLayout());
    JTextArea textArea=new JTextArea();
    frame.getContentPane().add(new JScrollPane(textArea),BorderLayout.CENTER);

    frame.show();
  }
}

---------- END SOURCE ----------
(Review ID: 166465) 
======================================================================

Comments
It seems this problem will be fixed soon by the fix jdk-6866751
08-04-2015

CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: mustang
25-09-2004

EVALUATION Name: ik75403 Date: 12/03/2002 This bug will not be fixed in mantis ====================================================================== Name: anR10225 Date: 08/27/2003 The text area preferred size doesn't take into account the caret width that's why there is no space for caret at the end of the longest line. We should take into account the caret width (DefaultCaret extends Rectangle) when calculating text area preferred width. ====================================================================== we had to roll back the fix for this bug. (see 4950107) ###@###.### 2003-11-11
11-11-2003