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

First character does not show in JTextArea when tabbed in from another JTextArea

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      win2000

      A DESCRIPTION OF THE PROBLEM :
      Bug 6202684 is still not solved. The problem still exists, when you tab with ctrl-tab from one textarea to another textarea. Sometimes the first character is not shown.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just create several JTextArea components, jump from one textarea to the next with ctrl-tab and type some keys.
      Using the Robot-class it should be easy to reproduce the problem (on 1.6.0_05-ea-b04, windows). Only in the first TextArea the first typed key is shown, in every next textarea the first character is lost.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The first typed character should be shown always
      ACTUAL -
      Sometimes the first typed character is not shown.

      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

      ---------- BEGIN SOURCE ----------


      import java.awt.Robot;
      import java.awt.event.KeyEvent;

      import javax.swing.BoxLayout;
      import javax.swing.JPanel;
      import javax.swing.JTextArea;


      public class Test
      {

          /**
           * @param args
           */
          public static void main(final String[] args)
          {
              try
              {
                  final javax.swing.JDialog dialog = new javax.swing.JDialog();
                  final JPanel panel = new JPanel();
                  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

                  dialog.getContentPane().add(panel);
                  panel.add(new JTextArea());
                  panel.add(new JTextArea());
                  panel.add(new JTextArea());
                  panel.add(new JTextArea());

                  dialog.setVisible(true);
                  dialog.setBounds(0, 0, 300, 300);
                  Thread.sleep(1000);

                  final Robot robot = new Robot();
                  System.out.println(System.getProperty("java.version"));

                  for (int i = 0; i < 10; i++)
                  {
                      robot.keyPress(KeyEvent.VK_1);
                      robot.keyRelease(KeyEvent.VK_1);
                      Thread.sleep(1000);
                      robot.keyPress(KeyEvent.VK_2);
                      robot.keyRelease(KeyEvent.VK_2);
                      Thread.sleep(1000);
                      robot.keyPress(KeyEvent.VK_3);
                      robot.keyRelease(KeyEvent.VK_3);
                      Thread.sleep(1000);

                      robot.keyPress(KeyEvent.VK_CONTROL);
                      robot.keyPress(KeyEvent.VK_TAB);
                      robot.keyRelease(KeyEvent.VK_CONTROL);
                      robot.keyRelease(KeyEvent.VK_TAB);
                      Thread.sleep(1000);
                  }
              }
              catch (Exception exc)
              {
                  exc.printStackTrace();
              }
          }
      }


      ---------- END SOURCE ----------

            son Oleg Sukhodolsky (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: