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

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

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.5
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description



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

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

        Attachments

          Activity

            People

            Assignee:
            tprinzinsunw Timothy Prinzing (Inactive)
            Reporter:
            vsizikov Vladimir Sizikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: