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

JDialog - textfield fails to accept keyboard input.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 6
    • orion3
    • client-libs
    • b53
    • sparc
    • solaris_9
    • Verified

      I have an issue with JDialog box in JDK1.5/JDK1.6 on Red Hat Linux Advanced Server release 2.1AS/i686.
      The text field in the dialogbox does not accept keyboard input, even
      though i see the cursor blinking in the text field. The workaround is
      to click on some other component in the dialog and back to textfield.

      I tried to reproduce the problem in a sample application, but the
      problem does not seem to occur. In my application also it does not
      appear consistently.

      Here is the code. I have created the same exact steps my app is using.
      I will file a bug.

      /*
       * DlgTest.java
       *
       * Created on January 5, 2005, 2:12 PM
       */
      import javax.swing.*;
      import java.awt.event.*;
      import java.awt.*;
      /**
       *
       * @author vp151719
       */
      public class DlgTest {
              static class MyDialog extends JDialog {
              MyDialog(Frame fr, String title, boolean modal) {
                  super(fr,modal);
                  JTextField tf = new JTextField();
                  setTitle(title);
                  //getContentPane().setLayout(new GridBagLayout());
                  setModal(true);
                  setLocation(100,100);
                  getContentPane().add(tf);
                  pack();
              }
          }
              /** Creates a new instance of DlgTest */
          public DlgTest() {
          }
              public static void main(String s[]) {
              final JFrame fr = new JFrame("DlgTest");
              JButton b = new JButton("Show Dialog");
              b.addActionListener(new ActionListener(){
                  public void actionPerformed(ActionEvent e) {
                      MyDialog d = new MyDialog(fr,"Hello",true);
                      d.setVisible(true);
                      d.setModal(true);
                  }
              });
              fr.getContentPane().add(b);
              fr.pack();
              fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              fr.setVisible(true);
          }
      }
      ###@###.### 2005-1-11 08:37:38 GMT

            dmikhalksunw Denis Mikhalkin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: