United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4648702 : TextArea horizontal scrollbar behavior is incorrect

Details
Type:
Bug
Submit Date:
2002-03-07
Status:
Closed
Updated Date:
2003-04-12
Project Name:
JDK
Resolved Date:
2002-08-08
Component:
client-libs
OS:
windows_xp,windows_2000
Sub-Component:
java.awt
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.4.1
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: kaR10181			Date: 03/06/2002




JDK version     : jdk1.4.1-b03
Platform[s]     : Windows 2000,Windows XP professional
switch/Mode     : -client -Xfuture -Xmixed

Java 2 Platform SE v1.4 specification reads about the class TextArea:
"
The following image shows the appearance of a text area:

[picture of TextArea]

This text area could be created by the following line of code:

--------------------------------------------------------------------------------

 new TextArea("Hello", 5, 40);
"
We should see both scrollbars as pictured, but really we see only
vertical scrollbar. Same behavior we have then we try to set
SCROLLBARS_BOTH flag. We can read from specification pages,"field detail"
section,in description of SCROLLBARS_BOTH flag the next phrase:"Create and
display both vertical and horizontal scrollbars", but we can see only
vertical.

------------------------TextAreaTest1.java---------------------------------------

import java.awt.*;


public class TextAreaTests1 extends Frame {

    TextArea    tArea;

    public void TextAreaTest0001() {

    tArea = new TextArea("TextAreaTests1", 5, 60, TextArea.SCROLLBARS_BOTH);
    add(tArea,null);
    }

    public static void main(String argv []) {
        TextAreaTests1 test = new TextAreaTests1();
        test.setVisible(true);
        test.TextAreaTest0001();
        test.setBounds(new Rectangle(0, 0, 200, 100));
        test.setVisible(true);
    }
}

Specific Machine Info:
======================

Hostname:       linux-16
Os:             Window XP professional

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

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis
mantis-b02

FIXED IN:
mantis
mantis-b02

INTEGRATED IN:
mantis
mantis-b02

VERIFIED IN:
mantis


                                     
2004-06-14
EVALUATION

I tried the code in the Description, and the code in the web page.  I tested 
with 1.4 and the latest promoted build of 1.4.1.  I see both scrollbars in all 
cases on solaris sparc 2.7 and windows NT.  (On windows NT, they are actually 
scrollbar tracks without scrollbars.)  

However, on Windows XP, the horizontal scrollbar does not appear until you add 
enough text to make it necessary.  When looking at the window in Spy++, the 
WS_HSCROLL style is not set on the window, even though it is clearly set in 
our source code.  On NT, the WS_HSCROLL style is set.  Note: the WS_VSCROLL 
style is always set for this test case, so on XP, WS_HSCROLL acts differently 
than on NT, and acts differently than WS_VSCROLL.  

This sounds like a bug in XP.  We speculated that Microsoft may consider it 
a feature, but it seems to violate their documentation.  It would make more 
sense for them to add a new style bit for scollbars_as_needed if they wanted 
to make a change.  

###@###.### 2002-03-07 

From awt_TextArea.cpp 

          /*
           * Specify ES_DISABLENOSCROLL - RichEdit control style to disable
           * scrollbars instead of hiding them when not needed.
           */
          DWORD style = WS_CHILD | WS_CLIPSIBLINGS | ES_LEFT | ES_MULTILINE |
              ES_WANTRETURN | ES_NOHIDESEL | scroll_style |
              (IS_WIN4X ? 0 : WS_BORDER) | ES_DISABLENOSCROLL;

So, they did add a new style bit for this feature.  It just doesn't seem 
to be working.  

###@###.### 2002-03-21


Name: dkR10074			Date: 05/22/2002


When we create a text area component (rich edit control) the
initial width of the control is 0. In this case Windows ignores
WS_HSCROLL style and hides the horizontal scrollbar. It looks
like a bug in Windows. As a workaround we might set the scroll
style after the rich edit control is created. It works ok.
The fix is based on this.

###@###.### 2002-05-22

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

If this workaround makes the test pass, we should try to get it into mantis.  
Commit to fix in Mantis (JCK).  

###@###.### 2002-05-24
                                     
2002-05-24



Hardware and Software, Engineered to Work Together