-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.4, 1.2.2, 1.3.0
-
x86, sparc
-
solaris_2.5.1, solaris_7, windows_nt
Name: joT67522 Date: 12/12/97
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)
======================================================================
- duplicates
-
JDK-4046446 ScrollPane limitation for large Canvas
- Resolved