JDK-4648702 : TextArea horizontal scrollbar behavior is incorrect
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_2000,windows_xp
  • CPU: x86
  • Submitted: 2002-03-07
  • Updated: 2003-04-12
  • Resolved: 2002-08-08
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
1.4.2 mantisFixed
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
14-06-2004

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
24-05-2002