Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4648702
Votes 0
Synopsis TextArea horizontal scrollbar behavior is incorrect
Category java:classes_awt
Reported Against hopper
Release Fixed 1.4.2(mantis)
State 10-Fix Delivered, Verified, bug
Priority: 4-Low
Related Bugs
Submit Date 07-MAR-2002
Description






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

======================================================================
Work Around
N/A
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.  

 xxxxx@xxxxx  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.  

 xxxxx@xxxxx  2002-03-21





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.

 xxxxx@xxxxx  2002-05-22

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

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

 xxxxx@xxxxx  2002-05-24
Comments
  
  Include a link with my name & email   

Submitted On 02-SEP-2002
Rj_carlos
Espero recibir información que me puedan facilitar referente al 
tema.


Submitted On 02-SEP-2002
Rj_carlos
Carlos Alberto Romero Jimenéz
Rj_carlos@hotmail.com



PLEASE NOTE: JDK6 is formerly known as Project Mustang