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

Scrollbar.setMinimum(int newMinimum) works wrong with Integer.MAX_VALUE

XMLWordPrintable

    • beta
    • sparc
    • solaris_2.5



      Name: dsC58869 Date: 06/16/98



      The method Scrollbar.setMinimum(int newMinimum) works wrong when
      newMinimum is Integer.MAX_VALUE. In this case the maximun of scrollbar
      will be less than minimum.

      ==== Here is the test demonstrating the bug ====
      import java.awt.*;

      public class Test{
          
          public static void main(String[] args){
           Scrollbar sb = new Scrollbar();
           sb.setMinimum(Integer.MAX_VALUE);
      System.out.println("MINIMUM: " + sb.getMinimum());
           System.out.println("MAXIMUM: " + sb.getMaximum());

           if(sb.getMaximum() < sb.getMinimum())
           System.out.println("FAILED: maximum less than minimum");
      System.exit(0);
          }
      }

      ==== Here is the output of the test ====
      %java Test
      MINIMUM: 2147483647
      MAXIMUM: -2147483648
      FAILED: maximum less than minimum

      ======================================================================
       Justification:
      The method sould work properly

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

            ehawkessunw Eric Hawkes (Inactive)
            dsilaev Dmitri Silaev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: