-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
swing1.0fcs
-
sparc
-
solaris_2.5.1
-
Verified
Name: akC57697 Date: 09/18/97
The com.sun.java.swing.JScrollBar.setValues(int,int,int,int) incompatible with
specification. It does not set minimum < maximum and extent >= 1.
"
public void setValues(int newValue,int newExtent,int newMinimum,int newMaximum)
Ensures that the model is always in a consistent state by enforcing
the following constraints.
minimum < maximum
minimum <= value
extent >= 1
value <= maximum - extent
If neccessary we change newValue and newExtent, newExtent is forced to be
greater than 0.
"
-------------------Example-----------------------------------
import com.sun.java.swing.*;
public class TestSetValues {
public static void main(String[] args) {
JScrollBar c = new JScrollBar();
c.setValues(0,0,0,0);
if (!( c.getMinimum()<c.getMaximum() && // Check the state
c.getMinimum()<=c.getValue() &&
c.getModel().getExtent()>=1 &&
c.getValue()<=(c.getMaximum()-c.getModel().getExtent() ))) {
System.out.println("Wrong values:"+c);
return;
}
System.out.println("OKAY");
return;
}
}
-------------------Output------------------------------------
Wrong values:com.sun.java.swing.JScrollBar[vertical, value=0, adj=false, extent=0, min=0, max=0, unit=1, block=0]
======================================================================