Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4008152

scrollPane.setScrollPosition() does not always result in correct values

    Details

    • Subcomponent:
    • CPU:
      generic, sparc
    • OS:
      solaris_2.5

      Description

      In the following sequence:

      scrollPane.setScrollPosition(0,0);
      Point pt = scrollPane.getScrollPosition();

      does not leave pt as 0,0.

      It isn't clear what the side effects of this are on hotjava, but it may
      be the cause of some scrolling and repainting bugs.


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

      ###@###.### 1998-01-23

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dav Andrei Dmitriev (Inactive)
                Reporter:
                jpampuchorcl John Pampuch (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: