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

AWT Choice does not always grab focus

XMLWordPrintable

    • x86
    • linux

      Name: dk106046 Date: 07/11/2002

      Found on Turbo 7.0

      1.4.1-rc-b16

      Testcase:

      ------ Start of AWTTest2.java
      import java.awt.*;
      import java.awt.event.*;

      public class AWTTest2 extends Frame {

          AWTTest2(){
              Choice c = new Choice();
              add(c);
              c.addItem("Choice1..................");
              c.addItem("Choice2..................");
              c.addItem("Choice3..................");
              c.setEnabled(true);
              c.setVisible(true);
              c.requestFocus();
              pack();
              show();
          }

          public static void main(String [] args) {
         
              AWTTest2 mt = new AWTTest2();
          }

      }
      ------ end of AWTTest2.java

      1. Compile above test case AWTTest2.java.

      2. Start 2 instances of AWTTest2 running (I'll refer to them as App1 and App2).

      3. On App1 bring up the list of choices (but don't select one).

      4. On App2 bring up list of choices and select one.

      5. Focus has now been lost - in fact typed keys now go to wherever the mouse is positioned (even over a console window).

            dav Andrei Dmitriev (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: