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

Constructor JTextField(int columns) doesn't throw IllegalArgumentException.

XMLWordPrintable

    • 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
      ----------------------------------------

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

            tprinzing Tim Prinzing
            vsizikov Vladimir Sizikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: