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

(1.1.6)component in frame with focus doesn't keep focus when frame regains focus

    XMLWordPrintable

Details

    • b01
    • x86
    • windows_nt

    Description



      Name: moC74494 Date: 05/21/98


      Since 1.1.6, if the Java application (running in a Frame) loses focus
      to any other window (doesn't matter if it's a Java Frame, another
      Windows application, or even a Java Dialog), the component in the
      Frame that had focus no longer retains that focus, as it had in
      1.1.5 and earlier.

      I noticed this problem on Windows, unsure if it's also in Solaris.

      Here is sample code that puts three buttons in a Frame:

      import java.awt.*;
      public class test
      {
            public test()
            {
      Frame f = new Frame("focus test");
      Panel p = new Panel();

      p.add(new Button("button 1"));
      p.add(new Button("button 2"));
      p.add(new Button("button 3"));
      f.add(p);

      f.pack();
      f.show();
            }
            public static void main(String[] argv)
            {
      test t = new test();
            }
      }


      Click on either button2 or button3, and switch to another
      window, then (without clicking a button) switch back to
      the test frame. Button1 will now have focus.

      We have an application that has a List box of items. When
      you hit return on one of the items, a Dialog box appears and
      allows you to edit the item. When you hit enter, we automatically
      select the next item in the list. Since focus (in 1.1.5) remained
      in the List component, the user can easily edit the next item in
      the list just by tapping return. Now with 1.1.6, focus leaves the
      List box and jumps up to the first button in our toolbar.

      I know it's probably possible to set up a bunch of focus listeners
      and stuff... but do I HAVE TO?? I'd rather it worked like it used
      to.
      (Review ID: 29427)
      ======================================================================

      Attachments

        Activity

          People

            rkhansunw Robi Khan (Inactive)
            moanceasunw Mircea Oancea (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: