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

DefaultBoundedRangeModel.setRangeProperties(...) works incorrectly.

XMLWordPrintable

    • 1.2.2
    • sparc
    • solaris_2.5.1
    • Verified



      Name: aaC67449 Date: 12/08/97



      DefaultBoundedRangeModel.setRangeProperties(int,int,int,int,boolean) works incorrectly with big numbers. When we try to set very big extent, it does not force the argument to fit the necessary ranges.

      javaDOC:
      "public void setRangeProperties(int newValue,
                                      int newExtent,
                                      int newMin,
                                      int newMax,
                                      boolean adjusting)

          The attribute-changing primitive. This method ensures that the model is always in a consistent state
          by enforcing the following constraints:

             minimum <= maximum
             minimum <= value
             value <= maximum - extent
             extent >= 0
           

          If the arguments don't satisfy these constraints, the arguments are forced to fit the necessary
          ranges. Notifies listeners if any attributes are changed.

      "

           ----------Example------------

      import java.awt.swing.*;

      public class Test {

      public static void main( String argv[] ) {

         DefaultBoundedRangeModel c=new DefaultBoundedRangeModel();
         c.setRangeProperties(10,Integer.MAX_VALUE,0,100,true); //set new values
                         if(!( c.getMinimum() <= c.getMaximum()
                            && c.getMinimum() <= c.getValue()
                            && c.getValue() <= c.getMaximum() - c.getExtent()
                            && c.getExtent() >= 0
                         )) {
                             System.out.println(" value extent min max");
                             System.out.println("Is: "
                                                  +c.getValue()+" "
                                                  +c.getExtent()+" "
                                                  +c.getMinimum()+" "
                                                  +c.getMaximum()+" ");
                             System.out.println("Test failed");
                        } else
                            System.out.println("OKEY");
                        

      }

      }
         ------------Output---------
                value extent min max
      Is: 10 2147483647 0 100



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

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: