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

REGRESSION: 2-column size JTextField can not contain 2 characters

XMLWordPrintable


      ###@###.### 2002-04-24

      J2SE Version (please include all output from java -version flag):
        java version "1.4.1-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b08)
        Java HotSpot(TM) Client VM (build 1.4.1-beta-b08, mixed mode)

      Does this problem occur on J2SE 1.3 or 1.4? Yes / No (pick one)
       No, works fine with 1.3 and 1.4FCS.

      Operating System Configuration Information (be specific):
       Windows NT Version 4 (SP 6)

      Bug Description:
       A JTextField created with a 2-column size is not able to contain 2
       characters (2 columns).

      Test Program:
      /**
       * EntryFieldHopper.java
       */
      import java.lang.*;
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.event.*;

      /**
       * Class: EntryFieldHopper
       */
      public class EntryFieldHopper extends javax.swing.JFrame
         {
          /**
           * Constructor: EntryFieldHopper
           * @return instance of EntryFieldHopper
           */
          public EntryFieldHopper()
             {
              super();
              /* javax.swing.JFrame - Bean Properties */
              setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
              setName("JFrame");
              setTitle("Title");
              /* javax.swing.JFrame - sets Bounds */
              setBounds(50,100,400,400);
              /* javax.swing.JFrame - Adds Child */
              JDesktopPane desktopPane = new javax.swing.JDesktopPane();
              getContentPane().add(desktopPane,java.awt.BorderLayout.CENTER);

              JTextField textField = new JTextField(2);
              /* JTextField - Bean Properties */
              textField.setName("JTextField");
              textField.setLocation(35,50);
              textField.setSize(textField.getPreferredSize());
              textField.setText("99");

              JPanel panel = new JPanel();
              /* JPanel - Bean Properties */
              panel.setName("JPanel");
              /* JPanel - set Layout */
              panel.setLayout(null);
              panel.add(textField);

              getContentPane().add(panel,java.awt.BorderLayout.CENTER);
              show();
             } /* End of Constructor: EntryFieldHopper */

          /**
           * Method: generalHandleException <br>
           * @param java.lang.Throwable exception
           * @return void
           */
          protected void generalHandleException(java.lang.Throwable exc)
             {
              exc.printStackTrace(System.err);
             } /* End of Method: generalHandleException */

          /**
           * Method: main <br>
           * Note: Called only if we're an application. <br>
           * @param java.lang.String[] args the command line arguments
           * @return void
           */
          public static void main(java.lang.String[] args)
             {
              try
                 {
                  /* Set native look and feel */
                  //
      javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());


      UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

                  /* Creates new MainObject */
                  EntryFieldHopper self = new EntryFieldHopper();
                 } /* End try */
              catch (java.lang.Throwable exc)
                 {
                  exc.printStackTrace(System.err);
                 } /* End catch */
             } /* End of Method: main */

         } /* End of Class: EntryFieldHopper */

            apikalev Andrey Pikalev
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: