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

Unable to type into TextArea of modal dialog without clicking the parent window

XMLWordPrintable

    • generic, x86
    • generic, windows_vista

      FULL PRODUCT VERSION :
      java version "1.6.0_10-beta"
      Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
      Java HotSpot(TM) Client VM (build 11.0-b12, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 6.0.6000

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The applet is run on Internet Explorer 7.0.6000

      A DESCRIPTION OF THE PROBLEM :
      User is unable to type into the textarea in a popup dialog. The only way to work around is to click on the parent of the dialog and then click the textarea again.

      I have replaced the TextArea object with a TextField object and that works. It seems it only happens to TextArea.

      This is working on 1.5.0_14 with Vista and 1.6.0_05 with XP. No test on 1.6.0_05 with Vista

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      In the test case sample,

      1. click the start button
      2. click inside the TextArea and then type. No text shows up.
      Now...
      3. Click the parent window( the browser window)
      4. Click the TextArea again and then you can type

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      User can click on the TextArea and then start typing
      ACTUAL -
      User is unable to type into the textarea

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;

      public class MyTest extends Applet implements ActionListener
      {
          Button btn;
          Dialog d;
          
          public MyTest() {
          }
          
          
          public void start() {
              btn = new Button("start");
              this.add(btn);
              btn.addActionListener(this);
          }
          
          
          public void actionPerformed(ActionEvent e) {
                 if (e.getActionCommand().equals("start"))
                 {
                     Component c = (Component)this;
                     while ( c.getParent() != null )
                        c = c.getParent();
       
                     if (!( c instanceof Frame))
                        c = null;
                     
                    d = new MyTextAreaDlg((Frame)c, "hello", true);
                    d.setSize(600, 350);
                    d.setVisible(true);
                    d.dispose();
                 }
          }
          
          
          public class MyTextAreaDlg extends Dialog implements ActionListener
          {
             Button okbtn, cancelbtn;
             TextArea txtarea;
              
             public MyTextAreaDlg(Frame owner, String title, boolean ismodal) {
                super (owner, title, ismodal);
                init();
            }
             
             
             void init() {
                // create the dialog layout and buttons
                setLayout(new BorderLayout());
                Panel p = new Panel();
                txtarea = new TextArea(10, 30);
                //txtarea = new TextField();
                p.add(txtarea);
                 
                cancelbtn = new Button("Cancel");
                add("Center", p);
                cancelbtn.addActionListener(this);
                add("South", cancelbtn);
             }
             
              public void actionPerformed(ActionEvent e) {
                 if (e.getActionCommand().equals("Cancel"))
                    setVisible(false);
              }
          }
          
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Click on the parent of the dialog and then click the textarea again.

      Release Regression From : 6u5
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            denis Denis Fokin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: