-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.1.5
-
sparc
-
solaris_2.5
-
Not verified
Name: vsC58871 Date: 10/15/97
Constructor JTextField(int columns) doesn't throw IllegalArgumentException when
the number of columns is negative, but method setColumns(int columns) does.
Here is an example demonstratring the bug:
----------------Test.java---------------------
import com.sun.java.swing.*;
public class Test{
public static void main(String[] args){
try{
JTextField field = new JTextField(-100);
System.out.println("IllegalArgumentException was not thrown by constructor");
}catch(IllegalArgumentException e){
System.out.println("IllegalArgumentException thrown by constructor");
}
JTextField field = new JTextField();
try{
field.setColumns(-100);
System.out.println("IllegalArgumentException was not thrown by setColumns() method");
}catch(IllegalArgumentException e){
System.out.println("IllegalArgumentException thrown by setColumns() method");
}
System.exit(0);
}
}
---------------- output ----------------
IllegalArgumentException was not thrown by constructor
IllegalArgumentException thrown by setColumns() method
----------------------------------------
======================================================================