JDK-4106195 : ScrollPane.setScrollPosition() does not always set position correctly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.6,1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1998-01-23
  • Updated: 1998-01-23
  • Resolved: 1998-01-23
Related Reports
Duplicate :  
Description

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
------------------------------

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

Comments
PUBLIC COMMENTS This bug report seems like duplicate of 4008152.
10-06-2004

EVALUATION This bug report is duplicate of 4008152. 4008152 has been updated with new test code. ###@###.### 1998-01-23
23-01-1998