-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
beta2
-
sparc
-
solaris_2.5
Name: dsC58869 Date: 06/16/98
The method
Scrollbar.setValues(int value, int visible, int minimum, int maximum)
works wrong when (maximum - minimum) greater than Integer.MAX_VALUE.
It sets the visible amount of the scrollbar to 1.
There is no reason to do this.
==== Here is the test demonstrating the bug ====
import java.awt.*;
public class Test1{
public static void main(String[] args){
Scrollbar sb = new Scrollbar();
sb.setValues(10, 100, -1, Integer.MAX_VALUE);
System.out.println("MINIMUM: " + sb.getMinimum());
System.out.println("MAXIMUM: " + sb.getMaximum());
System.out.println("VISIBLE: " + sb.getVisibleAmount());
if(sb.getMinimum() != -1 || sb.getMaximum() != Integer.MAX_VALUE)
return;
if (sb.getVisibleAmount() != 100) {
System.out.println("FAILED: wrong visible amount");
} else {
System.out.println("OKAY");
}
System.exit(0);
}
}
==== Here is the output of the test ====
%java Test1
MINIMUM: -1
MAXIMUM: 2147483647
VISIBLE: 1
FAILED: wrong visible amount
======================================================================
Justification:
The method sould work properly
======================================================================