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: 4099201
Votes 1
Synopsis Scroll Pane problems for large heights.
Category java:classes_awt
Reported Against 1.1.4 , 1.2.2 , kestrel-beta
Release Fixed
State 11-Closed, duplicate of 4046446, bug
Priority: 4-Low
Related Bugs 4046446
Submit Date 13-DEC-1997
Description




Attached is a slight modification of the code
I received from JDC Tech tips, which draws a
box in a ScrollPane, but takes the height of
the component from the command line.

It fails for large values of height like:

java scroll 60000

For me it worked upto:

java scroll 32816

For 32817 the bottom line was missing and
32818 onwards it did not draw properly.

Attached source code scroll.java compile it
and type java scroll 100 for example, fails
for argument 32818 or larger:

import java.awt.*;

class Box extends Component {
  int height, gap ;

    public Box(int height) {
        this.height=height ;
        gap=height<1000?5:50 ;
    }

    public Box() {
        height=300 ;
        gap=5 ;
    }

    public Dimension getPreferredSize() {
            return new Dimension(300, height);
    }

    public void paint(Graphics gr) {
        gr.setColor(Color.blue);
        gr.drawLine(5, gap, 295, gap);
        gr.drawLine(295, gap, 295, height-gap);
        gr.drawLine(295, height-gap, 5, height-gap);
        gr.drawLine(5, height-gap, 5, gap);
    }
}

public class scroll {
    public static void main(String args[]) {
        Frame fr = new Frame("ScrollPane test");
        ScrollPane pane = new ScrollPane();
        pane.setSize(200, 200);
        pane.add(new Box(Integer.parseInt(args[0])));

        fr.add(pane);
        fr.pack();
        fr.setVisible(true);

        Adjustable vadj = pane.getVAdjustable();
        Adjustable hadj = pane.getHAdjustable();
        vadj.setUnitIncrement(5);
        hadj.setUnitIncrement(5);
    }
}
(Review ID: 21855)
======================================================================
Work Around




Use scroll-bar class and handle your own
scrolling.

But this will preventing putting the component
with another one in a panel and putting the
whole thing in a ScrollPane
======================================================================
Evaluation




(K. Suresh, SIPTech, July 24, 1998)

WinNT - Bug is reproducible.
Works fine upto 32816 and it fails for argument 32817 or larger.
Tested with JDK-1.1.7-B, JDK-1.2beta4-F

Win95 - Bug is reproducible.
Works fine upto 32742 and it fails for argument 32743 or larger.
Tested with JDK-1.1.7-B, JDK-1.2beta4-F

Solaris/Intel - Bug is reproducible.
Works fine upto 32767 and it fails for argument 32768 or larger.
Tested with JDK-1.1.7-B, JDK-1.2beta4-J

Solaris/SPARC - Bug is reproducible.
Works fine upto 32767 and it fails for argument 32768 or larger.
Tested with JDK-1.1.7-B, JDK-1.2beta4-K

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

12/7/99   xxxxx@xxxxx   -- still reproducible as of 1.1.8, 1.2.2 and kestrel RA
(1.3.0 build "I") on Solaris.  For kestrel and 1.1.8, "32817" is the first
arg for which the problem shows up.  For 1.2.2, "32818" is the first arg that
shows the problem.

This appears to be a dupe of # 4046446.
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang