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

Tiger-b56, Bidi Text input is broken in all Text Components and exceptions are t

    Details

      Description



      Name: jbT81659 Date: 06/23/2004

      Locale: ar_SA, he_IL, en_US
      REGRESSION: YES
      Build: b56
      Bidi Text input in JTextArea, JTextFild, JEditorPane and JTextPane is broken. Characters are not displayed as they are typed into the text component. Pressing the "Control-Shift-O" shows all input characters on the end of the text component. In addition the following exception is thrown
       "Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1" is thrown.

      To reproduce the bug:
      Do the testing under Windows platform with arabic and Hebrew support
      1. Compile and run the attached test case (jTextField.java)
      2. Go to the first JTextField
      3. Select the text by pressing "Home+Shift+End" keys from the keyboard
      4. Press the "BackSpace"
      5. Note the following exceptions are thrown
      ------------------------------------------------------------------------
      Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1
      at javax.swing.text.CompositeView.getView(CompositeView.java:143)
      at javax.swing.text.TextLayoutStrategy$AttributedSegment.getFont(TextLayoutStrategy.java:370)
      at javax.swing.text.TextLayoutStrategy$AttributedSegment.getAttribute(TextLayoutStrategy.java:493)
      at javax.swing.text.TextLayoutStrategy$AttributedSegment.getAttributes(TextLayoutStrategy.java:476)
      at java.awt.font.TextLine.getFontAtCurrentPos(TextLine.java:1043)
      at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:221)
      at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:149)
      at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:292)
      at javax.swing.text.TextLayoutStrategy.sync(TextLayoutStrategy.java:287)
      at javax.swing.text.TextLayoutStrategy.removeUpdate(TextLayoutStrategy.java:65)
      at javax.swing.text.FlowView.removeUpdate(FlowView.java:254)
      at javax.swing.plaf.basic.BasicTextFieldUI$I18nFieldView.removeUpdate(BasicTextFieldUI.java:388)
      at javax.swing.plaf.basic.BasicTextUI$RootView.removeUpdate(BasicTextUI.java:1533)
      at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.removeUpdate(BasicTextUI.java:1777)
      at javax.swing.text.AbstractDocument.fireRemoveUpdate(AbstractDocument.java:242)
      at javax.swing.text.AbstractDocument.handleRemove(AbstractDocument.java:607)
      at javax.swing.text.AbstractDocument.remove(AbstractDocument.java:575)
      at javax.swing.text.DefaultEditorKit$DeletePrevCharAction.actionPerformed(DefaultEditorKit.java:1009)
      at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1572)
      at javax.swing.JComponent.processKeyBinding(JComponent.java:2730)
      at javax.swing.JComponent.processKeyBindings(JComponent.java:2765)
      at javax.swing.JComponent.processKeyEvent(JComponent.java:2693)
      at java.awt.Component.processEvent(Component.java:5263)
      at java.awt.Container.processEvent(Container.java:1966)
      at java.awt.Component.dispatchEventImpl(Component.java:3953)
      at java.awt.Container.dispatchEventImpl(Container.java:2024)
      at java.awt.Component.dispatchEvent(Component.java:3801)
      at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1810)
      at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:668)
      at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:916)
      at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:794)
      at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:632)
      at java.awt.Component.dispatchEventImpl(Component.java:3839)
      at java.awt.Container.dispatchEventImpl(Container.java:2024)
      at java.awt.Window.dispatchEventImpl(Window.java:1766)
      at java.awt.Component.dispatchEvent(Component.java:3801)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
      ------------------------------------------------------------------------
      5. Go to the any other JTextField
      6. Try to insert characters
      7. Note that characters you type are not displayed
      8. Note that cursor moves as you type
      9. Press "Ctrl+Shift+O" to change text alignment
      10. Note that text you typed is now displayed

      -------------------Test case-----------------
      /* Copyright (c) Sun Microsystems 1998

      $Header: /home-bazelet/sun/src/javaLab/JDK1.4/standard/jTextField.java,v 1.1.1.1 2001/06/19 15:01:31 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);
         }
      }
      ---------------------------------------------
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                idk Igor Kushnirskiy (Inactive)
                Reporter:
                jbenavrasunw Jonathan Benavraham (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: