-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.6, 1.2.0
-
sparc
-
solaris_2.5
Name: vsC58871 Date: 01/23/98
ScrollPane's methods setScrollPosition(int,int) and ScrollPosition(Point)
don't set position of scrollbars correctly.
Here is the example demonstrating the bug:
----------------Test.java---------------------
import java.awt.*;
public class Test {
public static void main(String [] args) {
Point p;
Frame frame = new Frame();
frame.setBounds(100,100,100,100);
ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
Canvas canvas = new Canvas();
canvas.setSize(300,300);
sp.add(canvas);
frame.add("Center",sp);
frame.setVisible(true);
for (int i=0;i<1000;i++) {
p = new Point(i%100,i%100);
sp.setScrollPosition(p);
if (!sp.getScrollPosition().equals(p)) {
System.out.println("Test Failed.");
System.out.println(i+" : Expected "+p+", but Returned: "+sp.getScrollPosition());
frame.dispose();
System.exit(0);
}
}
System.out.println("Test Passed.");
frame.dispose();
}
}
-- The output ----------------
#>java Test
Test Failed.
15 : Expected java.awt.Point[x=15,y=15], but Returned: java.awt.Point[x=12,y=15
------------------------------
======================================================================
- duplicates
-
JDK-4008152 scrollPane.setScrollPosition() does not always result in correct values
-
- Closed
-