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

JTextField displays and throws exceptions

XMLWordPrintable

    • 2d
    • x86
    • generic



      Name: jbT81659 Date: 11/24/2000

      OS: WinNT, Win98
      JDK:Merlin-Beta, jdk1.4.0-b41

      JTextField displays boxes instead of characters under WinNT. Inserting more chars to JTextField causes application to throw exceptions.

      To reproduce this bug:
      1- Compile and run the following code under WinNT or Win98(English/Arabic/Hebrew)
      2- Note that boxes are displayed instead of characters.
      3- Try to inser charaters into JTextField
      4- Note that application throws exceptions

      -------------Code----------
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home/sun/src/JDK1.2/jTextField.java,v 1.16 2000/03/30 08:13:08 isam Exp $

      */

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class jTextField extends JApplet
      {
      public void init()
      {
      textAAA text = new textAAA();
      getContentPane().add(text);
              }
      public static void main(String[] argv)
      {
                      JFrame frame = new JFrame("\u0645\u062b\u0627\u0644");
           frame.setContentPane(new textAAA());
           frame.pack();
           frame.setVisible(true);
              frame.addWindowListener( new WindowAdapter()
              {
                   public void windowClosing( WindowEvent e)
                   {
                       System.exit(0);
                   }
              });

      }
      }
      class textAAA extends JPanel
      {
              JTextField tf0,tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8,tf9,tf10;
      public textAAA()
      {
                      setLayout(new GridLayout(12,1));

                      JTextField tf0 = new JTextField(30);
                      tf0.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf0.setText("\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631");
                      tf0.setHorizontalAlignment(JTextField.LEFT);
                      add(tf0);

                      JTextField tf1 = new JTextField(30);
                      tf1.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf1.setText("\u0067\u062a\u0641\u0627\u062d\u0020\u0623\u062d\u0645\u0631\u0020\u0643\u0628\u064a\u0631");
                      tf1.setHorizontalAlignment(JTextField.RIGHT);

                      add(tf1);

                      JTextField tf2 = new JTextField(30);
                      tf2.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf2.setText("\u0648\u0644\u062f\u0020\u0635\u063a\u064a\u0631\u0020\u006c\u0069\u006d\u0065\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u0648\u062c\u0645\u064a\u0644");
                      tf2.setHorizontalAlignment(JTextField.RIGHT);
                      add(tf2);

                      JTextField tf3 = new JTextField(30);
                      tf3.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf3.setText("\u0067\u0647\u0630\u0627\u0020\u064a\u0648\u0645\u0020\u0644\u0637\u064a\u0641\u0020\u05d6\u05d4\u0020\u05d9\u05d5\u05dd\u0020\u05e0\u05e2\u05d9\u05dd");
                      tf3.setHorizontalAlignment(JTextField.RIGHT);
                      add(tf3);

                      JTextField tf4 = new JTextField(30);
                      tf4.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf4.setText("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4");
                      tf4.setHorizontalAlignment(JTextField.LEFT);
                      add(tf4);

                      JTextField tf5 = new JTextField(30);
                      tf5.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf5.setText("\u05d6\u05d5\u0020\u05e9\u05e0\u05d4\u0020\u05d9\u05e4\u05d4\u0020\u0054\u0048\u0045\u0020\u0059\u0045\u0041\u0052\u0020\u0031\u0039\u0035\u0038");
                      tf5.setHorizontalAlignment(JTextField.CENTER);
                      add(tf5);

                      JTextField tf6 = new JTextField(30);
                      tf6.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
      tf6.setText("\u05d7\u05d5\u05de\u05d5\u05e1\u0020\u0069\u0073\u0020\u0067\u0072\u0065\u0065\u006e\u0020\u05d9\u05e7\u05e8\u006c\u0069\u006d\u0065");
                      tf6.setHorizontalAlignment(JTextField.CENTER);
                      add(tf6);


                      JTextField tf7 = new JTextField(30);
                      tf7.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
                      tf7.setHorizontalAlignment(JTextField.LEFT);
                      add(tf7);

                      JTextField tf8 = new JTextField(30);
                      tf8.setFont(new Font("Lucida Sans Regular",Font.PLAIN,14));
                      tf8.setHorizontalAlignment(JTextField.RIGHT);
                      add(tf8);
         }
      }



      WorkAround:
      ======================================================================

            dougfelt Doug Felt
            jbenavrasunw Jonathan Benavraham (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: