-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
swing1.0fcs
-
sparc
-
solaris_2.5
-
Verified
Name: vsC58871 Date: 10/15/97
Methods setMinimum(int newMinimum) and setMaximum(int newMaximum) of JProgressBar
throw ArithmeticException when (newMinimum >= currentMaximum)
or (newMaximum <=currentMinimum).
Here is the documentation:
public void setMinimum(int n)
Sets the model's minimum to x.
If the current maximum or value is outside of the new minimum, the
maximum or value is adjusted accordingly.
Here is an example demonstratring the bug:
----------------Test.java---------------------
import com.sun.java.swing.*;
public class Test{
public static void main(String[] args){
JProgressBar bar = new JProgressBar();
bar.setMaximum(50);
bar.setMinimum(150);
System.exit(0);
}
}
---------------- output ----------------
java.lang.ArithmeticException: / by zero
at com.sun.java.swing.basic.BasicProgressBar.stateChanged(BasicProgressBar.java:194)
at com.sun.java.swing.event.ChangeListenerList.fireStateChanged(ChangeListenerList.java:53)
at com.sun.java.swing.JProgressBar$ModelListener.stateChanged(JProgressBar.java:190)
at com.sun.java.swing.event.ChangeListenerList.fireStateChanged(ChangeListenerList.java:53)
at com.sun.java.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:150)
at com.sun.java.swing.DefaultBoundedRangeModel.setMinimum(DefaultBoundedRangeModel.java:85)
at com.sun.java.swing.JProgressBar.setMinimum(JProgressBar.java:295)
at Test.main(Test.java:9)
----------------------------------------
======================================================================