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

api/java_awt/ScrollPane/descriptions.html#sets doesn't work correctly on windows.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      windows

      Description

      JCK : JCK6.0 b29
      J2SE : FAIL - mustang b97
      Platform[s] : FAIL - windows
      switch/Mode : FAIL - default

      It seems that consequent calls of setScrollPosition stops working properly after some time. Two JCK tests fail because of this:

      api/java_awt/ScrollPane/descriptions.html#sets[ScrollPane0408_15]
      api/java_awt/ScrollPane/descriptions.html#sets[ScrollPane0415_15]

      Steps to reproduce:

      run the following code on windows.

      import java.awt.*;
      import java.io.PrintWriter;
      import java.util.Properties;
      import java.util.Vector;

      public class ScrollPaneTest{

      public static void main(String[] args){
              Point p;
              Frame frame = new Frame();
              frame.setBounds(100, 100, 100, 100);
              ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); // Create new ScrollPane
              Canvas canvas = new Canvas(); // Create new Canvas
              canvas.setSize(200, 200);
              sp.add(canvas);
              frame.add("Center", sp);
              frame.setVisible(true);

              for (int i = 0; i < 10; i++) {
                  try
      {
      p = new Point(55, 55);
      sp.setScrollPosition(p.x, p.y);
                       waitForScrollPosition(sp, p);

      p = new Point(56, 56);
      sp.setScrollPosition(p.x, p.y);
                       waitForScrollPosition(sp, p);

                  }
      catch (InterruptedException e)
      {
                       frame.dispose();
                       System.out.println( "couldn't wait till the right scroll position" );
      return;
                  }
              }
              frame.dispose();
              System.out.println("OKAY");
       }


          public static void waitForScrollPosition(ScrollPane sp,Point p)
              throws InterruptedException {

              String lock = "the lock";
              synchronized (lock) {
      System.out.println("ScrollPositio is: "+sp.getScrollPosition()+" should be "+p);
                  for (int i=0; !p.equals(sp.getScrollPosition()) && (i < 10); i++) {
      System.out.println("ScrollPosition is: "+sp.getScrollPosition()+" should be "+p);
                      lock.wait(1000);
                  }
                  if ( !p.equals(sp.getScrollPosition()) ) {
                      System.out.println("set position: "+p);
                      System.out.println("get position: "+sp.getScrollPosition());
                      throw new InterruptedException("Bad scroll position for pretty long time");
                  }
              }
          }




      }


      You'll see that despite this code just moves scroll position from 55,55 to 56,56 and backwards it works for the first time but after some attempts goes to 0,56.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                yan Yuri Nesterenko
                Reporter:
                pastepan Pavel Stepanov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: